DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] ptr_compress: fix offset to use portable type
@ 2024-06-19 16:27 Paul Szczepanek
  2024-06-19 16:32 ` Luca Vizzarro
  2024-06-19 17:11 ` David Marchand
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Szczepanek @ 2024-06-19 16:27 UTC (permalink / raw)
  To: david.marchand; +Cc: dev, Paul Szczepanek, Nick Connolly

Fix the type of offset to use portable uintptr_t instead of uint64_t.

Fixes: 077596a4b077 ("ptr_compress: add pointer compression library")

Reviewed-by: Nick Connolly <nick.connolly@arm.com>
Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 lib/ptr_compress/rte_ptr_compress.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/ptr_compress/rte_ptr_compress.h b/lib/ptr_compress/rte_ptr_compress.h
index ca746970c0..9742a9594a 100644
--- a/lib/ptr_compress/rte_ptr_compress.h
+++ b/lib/ptr_compress/rte_ptr_compress.h
@@ -141,7 +141,7 @@ rte_ptr_compress_32_shift(void *ptr_base, void * const *src_table,
 		i += svcntd();
 	} while (i < n);
 #elif defined __ARM_NEON && !defined RTE_ARCH_ARMv8_AARCH32
-	uint64_t ptr_diff;
+	uintptr_t ptr_diff;
 	uint64x2_t v_ptr_table;
 	/* right shift is done by left shifting by negative int */
 	int64x2_t v_shift = vdupq_n_s64(-bit_shift);
@@ -202,7 +202,7 @@ rte_ptr_decompress_32_shift(void *ptr_base, uint32_t const *src_table,
 		i += svcntd();
 	} while (i < n);
 #elif defined __ARM_NEON && !defined RTE_ARCH_ARMv8_AARCH32
-	uint64_t ptr_diff;
+	uintptr_t ptr_diff;
 	uint64x2_t v_ptr_table;
 	int64x2_t v_shift = vdupq_n_s64(bit_shift);
 	uint64x2_t v_ptr_base = vdupq_n_u64((uint64_t)ptr_base);
@@ -215,7 +215,7 @@ rte_ptr_decompress_32_shift(void *ptr_base, uint32_t const *src_table,
 	}
 	/* process leftover single item in case of odd number of n */
 	if (unlikely(n & 0x1)) {
-		ptr_diff = ((uint64_t) src_table[i]) << bit_shift;
+		ptr_diff = ((uintptr_t) src_table[i]) << bit_shift;
 		dest_table[i] = RTE_PTR_ADD(ptr_base, ptr_diff);
 	}
 #else
--
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-19 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-19 16:27 [PATCH v1] ptr_compress: fix offset to use portable type Paul Szczepanek
2024-06-19 16:32 ` Luca Vizzarro
2024-06-19 16:45   ` David Marchand
2024-06-19 16:51     ` Luca Vizzarro
2024-06-19 17:11       ` David Marchand
2024-06-19 17:11 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).