base: Add more bit utils and bit struct class
Allows efficient, zero-cost, bitwise memory storage.
// Definition for type 'Example'
BITSTRUCT_DEFINE_START(Example, 10)
BitStructUint<0, 2> u2; // Every field must be a BitStruct[*].
BitStructInt<2, 7> i7;
BitStructUint<9, 1> i1;
BITSTRUCT_DEFINE_END(Example);
Would define a bit struct with this layout:
<- 1 -> <-- 7 --> <- 2 ->
+--------+---------------+-----+
| i1 | i7 | u2 +
+--------+---------------+-----+
10 9 2 0
See bit_struct.h for more documentation.
(Also adds new BitField[Extract|Insert|Clear] bit_utils similar
to the ARM bitfield instructions).
Test: art/test.py --gtest
Change-Id: I5e43f2468c5d275ee872546855527bb4ea73ad4c
6 files changed