How to do Bitwise AND Operation

0 votes
asked Aug 31 by hockinsk (140 points)
7 (MSB)6543210 (LSB)
langcodecopyrightborigbsdialnorm
1 or 01 or 01 or 00-31 (0 represents 31)


Sorry for the probably basic question. How would I extract the 4 fields values above using the mask feature? I'm using a hex mask successfully in another part of the file, but that is a simple mask on the whole byte value not at the bit level. From what I understand, if I took e.g. 'origbs' as an example, it will have a true/false value of 1/0. The byte has a value of 0x60 so...

origbs (Bit 5):

Mask: 0x20 (which is 00100000 in binary)

Extraction: (0x60 & 0x20) >> 5

Result: (0x60 & 0x20) >> 5 = (01100000 & 00100000) >> 5 = 00100000 >> 5 = 0x1 (or 1 in decimal)

Is this possible please and if so how do I set it up? Thank you.

Please log in or register to answer this question.

...