Add swap utility
This commit is contained in:
@@ -49,6 +49,11 @@ BEGIN_C_LINKAGE
|
|||||||
|
|
||||||
#define wpMiscUtilsIsPowerOfTwo(NUM) ((NUM & (NUM - 1)) == 0)
|
#define wpMiscUtilsIsPowerOfTwo(NUM) ((NUM & (NUM - 1)) == 0)
|
||||||
#define wpMiscUtilsOffsetPointer(PTR, OFFSET) ((void *)((uptr)(PTR) + (OFFSET)))
|
#define wpMiscUtilsOffsetPointer(PTR, OFFSET) ((void *)((uptr)(PTR) + (OFFSET)))
|
||||||
|
#define wpMiscUtilsSwap(TYPE, A_PTR, B_PTR) do { \
|
||||||
|
TYPE tmp = *(A_PTR); \
|
||||||
|
*(A_PTR) = *(B_PTR); \
|
||||||
|
*(B_PTR) = tmp; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
wp_intern inline u64 wpMiscUtilsRotl64(u64 x, i8 rotation) {
|
wp_intern inline u64 wpMiscUtilsRotl64(u64 x, i8 rotation) {
|
||||||
return (x << rotation) | (x >> (64 - rotation));
|
return (x << rotation) | (x >> (64 - rotation));
|
||||||
|
|||||||
Reference in New Issue
Block a user