I want to get the lowest bytes of an uint16_t in C.
Example:
20544 = 0x5040
0x40 = 64
I tried, (X & ((1<<2) - 1)). This doesn't work for me.
I want to get the lowest bytes of an uint16_t in C.
Example:
20544 = 0x5040
0x40 = 64
I tried, (X & ((1<<2) - 1)). This doesn't work for me.
Copyright © 2021 Jogjafile Inc.
You use bytes (plural), but a
uint16_tis composed of two bytes, so I'm assuming you mean the least significant byte (singular). If that's so, here is one way of obtaining it: