I want to be able to extract and concatenate bits that make up different llvm::Value
's.
For example, I want to be able to extract 5 bits from offset 3 from a i32
, or to concatenate bits of i5
and i3
to get i8
. What is the best way to do this? I tried to use pointers and vectors, but vectors only work with same-sized structures (so no way to put an i5
and i3
inside the same vector) and pointer arithmetic can only be performed with respect to bytes.
Asked
Active
Viewed 66 times
0

Alex Babushkin
- 63
- 6
-
1Your best option will probably be to generate a sequence of and, shift and or operations. That's what the CPU will do at the end of the compilation pipeline anyway. – arnt Oct 24 '22 at 13:42