mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-25 11:08:54 +00:00
bitops: Add MAKE_64BIT_MASK macro
Add a macro that creates a 64bit value which has length number of ones shifted across by the value of shift. Backports commit ae2923b5c20a21c6457680330506a9c13873485c from qemu
This commit is contained in:
parent
efc6cc2b83
commit
fbb0645fb3
1 changed files with 3 additions and 0 deletions
|
@ -26,6 +26,9 @@
|
||||||
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
|
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
|
||||||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
||||||
|
|
||||||
|
#define MAKE_64BIT_MASK(shift, length) \
|
||||||
|
(((~0ULL) >> (64 - (length))) << (shift))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_bit - Set a bit in memory
|
* set_bit - Set a bit in memory
|
||||||
* @nr: the bit to set
|
* @nr: the bit to set
|
||||||
|
|
Loading…
Reference in a new issue