Currently, the bitCast builtin function works such that it "Asserts that @sizeOf(@TypeOf(value)) == @sizeOf(DestType)." I'm proposing that this is changed to be bitSizeOf to exclude padding bytes.
Why?
The main place I've found this interferes with programming is bit-casting to an integer which is a non-power of two in size. For example,
would not work because u24 is 4 bytes wide according to sizeOf, while Foo is 3 bytes wide, as is expected. Using bitSizeOf, this would compile, since both are 24 bits wide.
Currently, the bitCast builtin function works such that it "Asserts that
@sizeOf(@TypeOf(value)) == @sizeOf(DestType)
." I'm proposing that this is changed to be bitSizeOf to exclude padding bytes.Why?
The main place I've found this interferes with programming is bit-casting to an integer which is a non-power of two in size. For example,
would not work because u24 is 4 bytes wide according to sizeOf, while Foo is 3 bytes wide, as is expected. Using bitSizeOf, this would compile, since both are 24 bits wide.