Why @bitCast reverses bits when casting type to array?

Devlog :high_voltage: New @bitCast Semantics and LLVM Backend Improvements

Every type which supports @bitCast has a “logical bit layout”—a representation of that type as an ordered sequence of bits. For instance, u5 is composed of 5 logical bits, which we order from least-significant to most-significant.

EDIT:
Just to add more context, this is a new change (i.e part of 0.17.0), and the whole article is worth looking into and reading.

6 Likes