Bit handling

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I've got the following problem: I have a 16bit integer, and I want to get the value, that is represented by the last 13 bits, like that

XXX????????????? //I'm interested in all that is covered by '?

Additionally, I need to convert this value to integer. For all that, I wrote the following macro, but I'm not sure if it's working properly, so please have a look

#define OFFSET(offset) (offset & 0x1fff

This one should give me these 13 bits, correct

Thanks a lo
Sam
 
Back
Top