subspace icon indicating copy to clipboard operation
subspace copied to clipboard

Use empty alignment bits of pointers to store Result state

Open danakj opened this issue 8 months ago • 2 comments

For Dawn, a Result<ptr, ptr> can be stored in a single pointer (cc: @Kangz) when their values are known to never overlap.

While we can't hold two different newtype wrappers in the same storage, and drop the boolean. We can drop the E storage if it can be held in the T.

This is similar to Option representation but it requires two types, and they must share compatible storage. We may not need the types to opt in at all even, just compatible storage. To be constexpr we can't use reinterpret_cast, so for pointers they would need to be the same or related (static_cast).

danakj avatar Oct 16 '23 20:10 danakj