From b880441654c6d50fea4fd59061ee0cd486090073 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 21 Dec 2018 09:48:29 +0100 Subject: lib:util: Use PULL_LE_(U16|U32) for SVAL and IVAL Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- lib/util/byteorder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h index 8db14d3ab8a..053c4d22f5f 100644 --- a/lib/util/byteorder.h +++ b/lib/util/byteorder.h @@ -95,8 +95,8 @@ it also defines lots of intermediate macros, just ignore those :-) #define PVAL(buf,pos) (CVAL(buf,pos)) #define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val)) -#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) -#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) +#define SVAL(buf,pos) (uint32_t)PULL_LE_U16(buf, pos) +#define IVAL(buf,pos) PULL_LE_U32(buf, pos) #define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(uint8_t)((val)&0xFF),CVAL_NC(buf,pos+1)=(uint8_t)((val)>>8)) #define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) #define SVALS(buf,pos) ((int16_t)SVAL(buf,pos)) -- cgit v1.2.1