[1/5] table: use abstracted bit count functions

Message ID 1698887132-5347-2-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series use abstracted bit count functions |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Nov. 2, 2023, 1:05 a.m. UTC
  Use rte_clz64 instead of __builtin_clzl
Use rte_ctz64 instead of __builtin_ctzl

Fixes: 18898c4d06f9 ("eal: use abstracted bit count functions")

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/table/rte_lru_arm64.h      | 2 +-
 lib/table/rte_swx_table_em.c   | 4 ++--
 lib/table/rte_table_hash_ext.c | 4 ++--
 lib/table/rte_table_hash_lru.c | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/lib/table/rte_lru_arm64.h b/lib/table/rte_lru_arm64.h
index add889a..ddfd841 100644
--- a/lib/table/rte_lru_arm64.h
+++ b/lib/table/rte_lru_arm64.h
@@ -33,7 +33,7 @@ 
 	uint16x4_t min_vec = vmov_n_u16(vminv_u16(lru_vec));
 	uint64_t mask = vget_lane_u64(vreinterpret_u64_u16(
 			vceq_u16(min_vec, lru_vec)), 0);
-	return __builtin_clzl(mask) >> 4;
+	return rte_clz64(mask) >> 4;
 }
 #define lru_pos(bucket) f_lru_pos(bucket->lru_list)
 
diff --git a/lib/table/rte_swx_table_em.c b/lib/table/rte_swx_table_em.c
index 84837c8..8d67c05 100644
--- a/lib/table/rte_swx_table_em.c
+++ b/lib/table/rte_swx_table_em.c
@@ -260,8 +260,8 @@  struct table {
 	if (!params->hash_func)
 		t->params.hash_func = rte_hash_crc;
 
-	t->key_size_shl = __builtin_ctzl(key_size);
-	t->data_size_shl = __builtin_ctzl(key_data_size);
+	t->key_size_shl = rte_ctz64(key_size);
+	t->data_size_shl = rte_ctz64(key_data_size);
 	t->n_buckets = n_buckets;
 	t->n_buckets_ext = n_buckets_ext;
 	t->total_size = total_size;
diff --git a/lib/table/rte_table_hash_ext.c b/lib/table/rte_table_hash_ext.c
index 51a20ac..1cf0fc2 100644
--- a/lib/table/rte_table_hash_ext.c
+++ b/lib/table/rte_table_hash_ext.c
@@ -243,8 +243,8 @@  struct rte_table_hash {
 
 	/* Internal */
 	t->bucket_mask = t->n_buckets - 1;
-	t->key_size_shl = __builtin_ctzl(p->key_size);
-	t->data_size_shl = __builtin_ctzl(entry_size);
+	t->key_size_shl = rte_ctz64(p->key_size);
+	t->data_size_shl = rte_ctz64(entry_size);
 
 	/* Tables */
 	key_mask_offset = 0;
diff --git a/lib/table/rte_table_hash_lru.c b/lib/table/rte_table_hash_lru.c
index a4e1a05..5f28710 100644
--- a/lib/table/rte_table_hash_lru.c
+++ b/lib/table/rte_table_hash_lru.c
@@ -220,8 +220,8 @@  struct rte_table_hash {
 
 	/* Internal */
 	t->bucket_mask = t->n_buckets - 1;
-	t->key_size_shl = __builtin_ctzl(p->key_size);
-	t->data_size_shl = __builtin_ctzl(entry_size);
+	t->key_size_shl = rte_ctz64(p->key_size);
+	t->data_size_shl = rte_ctz64(entry_size);
 
 	/* Tables */
 	key_mask_offset = 0;