summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-12-20 11:24:29 +0100
committerAndrew Bartlett <abartlet@samba.org>2020-02-21 02:09:33 +0000
commit83cb44dbe8a4181805770195c2ef7afef72de17d (patch)
tree520d8ca6ecfa0c97069090692ea3662d25aa6e9b
parentc3b627f476fa1980bb4453233ce6cd5a2f53a78b (diff)
downloadsamba-83cb44dbe8a4181805770195c2ef7afef72de17d.tar.gz
lib:util: Use (PULL|PUSH)_BE_(U16|U32|U64) for R*VAL*
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--lib/util/byteorder.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h
index 6defa585b13..1330e82f5c8 100644
--- a/lib/util/byteorder.h
+++ b/lib/util/byteorder.h
@@ -107,9 +107,9 @@ it also defines lots of intermediate macros, just ignore those :-)
#define SIVALS(buf,pos,val) PUSH_LE_U32(buf, pos, val)
/* 64 bit macros */
-#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
+#define BVAL(p, ofs) PULL_LE_U64(p, ofs)
#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
+#define SBVAL(p, ofs, v) PUSH_LE_U64(p, ofs, v)
#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
/* now the reverse routines - these are used in nmb packets (mostly) */
@@ -117,17 +117,17 @@ it also defines lots of intermediate macros, just ignore those :-)
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
#define BREV(x) ((IREV((uint64_t)x)<<32) | (IREV(((uint64_t)x)>>32)))
-#define RSVAL(buf,pos) SREV(SVAL(buf,pos))
-#define RSVALS(buf,pos) SREV(SVALS(buf,pos))
-#define RIVAL(buf,pos) IREV(IVAL(buf,pos))
-#define RIVALS(buf,pos) IREV(IVALS(buf,pos))
-#define RBVAL(buf,pos) BREV(BVAL(buf,pos))
-#define RBVALS(buf,pos) BREV(BVALS(buf,pos))
-#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
-#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
-#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
-#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
-#define RSBVAL(buf,pos,val) SBVAL(buf,pos,BREV(val))
-#define RSBVALS(buf,pos,val) SBVALS(buf,pos,BREV(val))
+#define RSVAL(buf,pos) (uint32_t)PULL_BE_U16(buf, pos)
+#define RSVALS(buf,pos) PULL_BE_U16(buf, pos)
+#define RIVAL(buf,pos) PULL_BE_U32(buf, pos)
+#define RIVALS(buf,pos) PULL_BE_U32(buf, pos)
+#define RBVAL(buf,pos) PULL_BE_U64(buf, pos)
+#define RBVALS(buf,pos) PULL_BE_U64(buf, pos)
+#define RSSVAL(buf,pos,val) PUSH_BE_U16(buf, pos, val)
+#define RSSVALS(buf,pos,val) PUSH_BE_U16(buf, pos, val)
+#define RSIVAL(buf,pos,val) PUSH_BE_U32(buf, pos, val)
+#define RSIVALS(buf,pos,val) PUSH_BE_U32(buf, pos, val)
+#define RSBVAL(buf,pos,val) PUSH_BE_U64(buf, pos, val)
+#define RSBVALS(buf,pos,val) PUSH_BE_U64(buf, pos, val)
#endif /* _BYTEORDER_H */