Given that all values of u8 are meanginful, there is no space for an extra bit, so it is no surprise that it cannot be packed.
For pointers, for example, it is typical to exploit the fact that the null pointer is a meaningless value and thus rely on this sentinel value to encode the absence of value, but in general this is only possible if such a sentinel value is possible to begin with. -- Matthieu On Wed, Jul 24, 2013 at 6:33 PM, Brendan Zabarauskas <[email protected]>wrote: > On 25/07/2013, at 2:15 AM, Evan Martin <[email protected]> wrote: > > Is an Option<u8> implemented as a pair of (type, value) or is it packed > into a single word? > > > A quick test shows: > > rusti> std::sys::size_of::<Option<u8>>() > 16 > > ~Brendan > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
