From 841e243625b46d5966bde59fbdc575cd70174278 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 20 Dec 2018 11:21:00 +0100 Subject: lib:util: Use _DATA_BYTE(_CONST) from bytearray.h Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- lib/util/byteorder.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/util') diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h index d58e6d0b7d7..8db14d3ab8a 100644 --- a/lib/util/byteorder.h +++ b/lib/util/byteorder.h @@ -20,6 +20,8 @@ #ifndef _BYTEORDER_H #define _BYTEORDER_H +#include "bytearray.h" + /* This file implements macros for machine independent short and int manipulation @@ -88,8 +90,8 @@ it also defines lots of intermediate macros, just ignore those :-) */ -#define CVAL(buf,pos) ((unsigned int)(((const uint8_t *)(buf))[pos])) -#define CVAL_NC(buf,pos) (((uint8_t *)(buf))[pos]) /* Non-const version of CVAL */ +#define CVAL(buf,pos) ((uint32_t)_DATA_BYTE_CONST(buf, pos)) +#define CVAL_NC(buf,pos) _DATA_BYTE(buf, pos) /* Non-const version of CVAL */ #define PVAL(buf,pos) (CVAL(buf,pos)) #define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val)) -- cgit v1.2.1