mirror of
https://passt.top/passt
synced 2025-06-08 00:35:33 +02:00
tcp, udp, util: Fixes for bitmap handling on big-endian, casts
Bitmap manipulating functions would otherwise refer to inconsistent sets of bits on big-endian architectures. While at it, fix up a couple of casts. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
4c7304db85
commit
caa22aa644
5 changed files with 16 additions and 7 deletions
2
util.h
2
util.h
|
@ -43,6 +43,8 @@ void debug(const char *format, ...);
|
|||
#define ROUND_DOWN(x, y) ((x) & ~((y) - 1))
|
||||
#define ROUND_UP(x, y) (((x) + (y) - 1) & ~((y) - 1))
|
||||
|
||||
#define BITMAP_BIT(n) (1UL << (n) % (sizeof(long) * 8))
|
||||
#define BITMAP_WORD(n) (n / (sizeof(long) * 8))
|
||||
|
||||
#define SWAP(a, b) \
|
||||
do { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue