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
 
the macro seems to be correct for getting the final 13bit number,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top