diff options
author | Mauro Sardara <msardara@cisco.com> | 2022-08-26 15:02:12 +0000 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-09-01 13:20:29 +0000 |
commit | 940228d74920fbfd6707e1324711164360cca52d (patch) | |
tree | 1810371558a8f3efd5e9eb2e5ac042c98e354d50 /lib/includes/hicn/util | |
parent | 8d7d5327ca86871cdf1d2ce404ca88bb2a58630f (diff) |
feat(hicn-plugin): interest manifest
Ref: HICN-748
Change-Id: Ie403de53a93094dca997cec379db6f5d3ce8e6be
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'lib/includes/hicn/util')
-rw-r--r-- | lib/includes/hicn/util/bitmap.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/includes/hicn/util/bitmap.h b/lib/includes/hicn/util/bitmap.h index 68541bc28..d83c838b7 100644 --- a/lib/includes/hicn/util/bitmap.h +++ b/lib/includes/hicn/util/bitmap.h @@ -40,7 +40,7 @@ typedef hicn_uword bitmap_t; #define BITMAP_INVALID_INDEX ((uint32_t) (~0)) static inline int -get_lowest_set_bit_index (hicn_uword w) +hicn_get_lowest_set_bit_index (hicn_uword w) { return hicn_uword_bits > 32 ? __builtin_ctzll (w) : __builtin_ctz (w); } @@ -132,7 +132,7 @@ _bitmap_set_no_check (bitmap_t *bitmap, off_t i) { size_t offset = i / BITMAP_WIDTH (bitmap); size_t pos = i % BITMAP_WIDTH (bitmap); - bitmap[offset] |= (bitmap_t) 1 << pos; + bitmap[offset] |= (hicn_uword) (1) << pos; return 0; } @@ -178,7 +178,7 @@ _bitmap_unset (bitmap_t *bitmap, off_t i, int check) return -1; size_t offset = i / BITMAP_WIDTH (bitmap); size_t pos = i % BITMAP_WIDTH (bitmap); - bitmap[offset] &= ~(1ul << pos); + bitmap[offset] &= ~((hicn_uword) (1) << pos); return 0; } @@ -258,13 +258,13 @@ bitmap_next_set_no_check (const bitmap_t *bitmap, hicn_uword i, size_t length) // This will zeroes all bits < i tmp = bitmap[pos] & mask; if (tmp) - return get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; + return hicn_get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; for (pos += 1; pos < length; pos++) { tmp = bitmap[pos]; if (tmp) - return get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; + return hicn_get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; } } @@ -291,13 +291,13 @@ bitmap_next_unset_no_check (const bitmap_t *bitmap, hicn_uword i, // This will zeroes all bits < i tmp = ~bitmap[pos] & mask; if (tmp) - return get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; + return hicn_get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; for (pos += 1; pos < length; pos++) { tmp = ~bitmap[pos]; if (tmp) - return get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; + return hicn_get_lowest_set_bit_index (tmp) + pos * WORD_WIDTH; } } return BITMAP_INVALID_INDEX; |