Consider the following program fragment:
Code: Select all
static BitField<int8u> data;
data.bitRange(0, 4) = 0; //- clear bits 0..3 (4 bits) (data=0x00)
data(4, 4) = -1; //- set bits 4..7 (4 bits) to -1 (data=0xF0)
data(1, 2) = -1; //- set bits 1..2 (2 bits) to -1 (data=0xF6)
Code: Select all
c6 05 00 00 00 00 f6 movb $0xf6,0(%rip)
I am thinking of making a template class for value types, for instance int8, int16, int32, int64 and there unsigned equivalents were these bit manipulation function are incorporated.
Usefull or not.