aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/bitXXgen.h.tpl
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2014-06-16 16:38:31 +0200
committerSylvain Munaut <tnt@246tNt.com>2014-06-16 16:38:31 +0200
commit3baa0d6ab5b56b80725b69e03701af3af1680b2c (patch)
treeee4213b62a4fe12b0eebc07a8b7ed8df134f09aa /include/osmocom/core/bitXXgen.h.tpl
parent26ea7068e70bbfee9fb2117431ce8593e9df4e2a (diff)
core/bitXXgen: Use explicit cast of void* to uint8_t
Turns out we use this header in C++ code ... Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'include/osmocom/core/bitXXgen.h.tpl')
-rw-r--r--include/osmocom/core/bitXXgen.h.tpl10
1 files changed, 6 insertions, 4 deletions
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++);
}