How can I convert Vec bytes Byte
to BitVector (bytes * 8)
? Is there a function similar to v2bv
?
You should be able to use pack
for that, pack :: BitPack a => a -> BitVector (BitSize a)
, the compiler should be able to figure out that the size is the same!
3 Likes
In general, you can convert to any two types with the same bit size using bitCoerce
. For example, this should work:
f :: Vec 4 (BitVector 8) -> Vec 8 (BitVector 4)
f = bitCoerce
2 Likes