From 3baa0d6ab5b56b80725b69e03701af3af1680b2c Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Mon, 16 Jun 2014 16:38:31 +0200 Subject: core/bitXXgen: Use explicit cast of void* to uint8_t Turns out we use this header in C++ code ... Signed-off-by: Sylvain Munaut --- include/osmocom/core/bitXXgen.h.tpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/osmocom/core/bitXXgen.h.tpl b/include/osmocom/core/bitXXgen.h.tpl index 35f26db7..5fa2bb71 100644 --- a/include/osmocom/core/bitXXgen.h.tpl +++ b/include/osmocom/core/bitXXgen.h.tpl @@ -56,10 +56,11 @@ static inline uintXX_t osmo_loadXXbe_ext(const void *p, uint8_t n) * \param[out] p Buffer to store integer * \param[in] n Number of bytes to store */ -static inline void osmo_storeXXle_ext(uintXX_t x, uint8_t *p, uint8_t n) +static inline void osmo_storeXXle_ext(uintXX_t x, void *p, uint8_t n) { uint8_t i; - for(i = 0; i < n; p[i] = (x >> i * 8) & 0xFF, i++); + uint8_t *q = (uint8_t *)p; + for(i = 0; i < n; q[i] = (x >> i * 8) & 0xFF, i++); } /*! \brief store unaligned n-byte integer (big-endian encoding) into uintXX_t @@ -67,10 +68,11 @@ static inline void osmo_storeXXle_ext(uintXX_t x, uint8_t *p, uint8_t n) * \param[out] p Buffer to store integer * \param[in] n Number of bytes to store */ -static inline void osmo_storeXXbe_ext(uintXX_t x, uint8_t *p, uint8_t n) +static inline void osmo_storeXXbe_ext(uintXX_t x, void *p, uint8_t n) { uint8_t i; - for(i = 0; i < n; p[i] = (x >> ((n - 1 - i) * 8)) & 0xFF, i++); + uint8_t *q = (uint8_t *)p; + for(i = 0; i < n; q[i] = (x >> ((n - 1 - i) * 8)) & 0xFF, i++); } -- cgit v1.2.3