aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pool.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-06-29 03:22:44 -0700
committerDave Barach <openvpp@barachs.net>2018-06-30 13:49:15 +0000
commitfcd23686c4c5bed8066ea902e0bc1489c0a50daf (patch)
tree9c6354cd681110928f90915f1ec84d619645dda0 /src/vppinfra/pool.h
parentef8ead55e519091cc139ba3ef35c72564f1f8dc1 (diff)
bitmap: add nocheck variants for bit ops
Change-Id: Ifd155e2980a9f8e6af9bb6b08619c15b2bf18ef1 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vppinfra/pool.h')
-rw-r--r--src/vppinfra/pool.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index d1a2be9ddcd..2b8e0581e38 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -201,8 +201,9 @@ do { \
/* Return free element from free list. */ \
uword _pool_var (i) = _pool_var (p)->free_indices[_pool_var (l) - 1]; \
(E) = (P) + _pool_var (i); \
- clib_bitmap_set_no_check (_pool_var (p)->free_bitmap, \
- _pool_var (i), 0); \
+ _pool_var (p)->free_bitmap = \
+ clib_bitmap_andnoti_notrim (_pool_var (p)->free_bitmap, \
+ _pool_var (i)); \
_vec_len (_pool_var (p)->free_indices) = _pool_var (l) - 1; \
} \
else \
@@ -220,7 +221,6 @@ do { \
pool_aligned_header_bytes, \
/* align */ (A)); \
E = vec_end (P) - 1; \
- pool_validate_index (P, vec_len(P)-1); \
} \
} while (0)
@@ -264,7 +264,7 @@ do { \
({ \
pool_header_t * _pool_var (p) = pool_header (P); \
uword _pool_var (i) = (E) - (P); \
- (_pool_var (i) < vec_len (P)) ? clib_bitmap_get_no_check (_pool_var (p)->free_bitmap, _pool_i) : 1; \
+ (_pool_var (i) < vec_len (P)) ? clib_bitmap_get (_pool_var (p)->free_bitmap, _pool_i) : 1; \
})
/** Use free bitmap to query whether given index is free */
@@ -279,8 +279,9 @@ do { \
ASSERT (! pool_is_free (P, E)); \
\
/* Add element to free bitmap and to free list. */ \
- clib_bitmap_set_no_check (_pool_var (p)->free_bitmap, \
- _pool_var (l), 1); \
+ _pool_var (p)->free_bitmap = \
+ clib_bitmap_ori_notrim (_pool_var (p)->free_bitmap, \
+ _pool_var (l)); \
\
/* Preallocated pool? */ \
if (_pool_var (p)->max_elts) \