summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-09 15:51:43 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-09 15:51:43 +0000
commit7d82c240e27e921a859441669a15a095a2e5bff5 (patch)
treef41bb2028188771121e6de2c7516ef7438d8daa6
parent5a3ea52d4a567a341c8f2243783afdb392991ea2 (diff)
downloadsamba-7d82c240e27e921a859441669a15a095a2e5bff5.tar.gz
samba-7d82c240e27e921a859441669a15a095a2e5bff5.tar.bz2
samba-7d82c240e27e921a859441669a15a095a2e5bff5.zip
moved the array macros outside of the CAREFUL_ALIGNMENT define.
(This used to be commit d9fcf11aa04ff04dcbccd628322240f8324ae51d)
-rw-r--r--source3/include/byteorder.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h
index 4991338f26..0664a33817 100644
--- a/source3/include/byteorder.h
+++ b/source3/include/byteorder.h
@@ -128,6 +128,7 @@ it also defines lots of intermediate macros, just ignore those :-)
#if CAREFUL_ALIGNMENT
+
#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 SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8)
@@ -138,7 +139,9 @@ it also defines lots of intermediate macros, just ignore those :-)
#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val)))
#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val)))
#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val)))
+
#else
+
/* this handles things for architectures like the 386 that can handle
alignment errors */
/*
@@ -158,6 +161,11 @@ it also defines lots of intermediate macros, just ignore those :-)
#define SSVALS(buf,pos,val) SVALS(buf,pos)=((int16)(val))
#define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val))
+#endif
+
+
+/* macros for reading / writing arrays */
+
#define SMBMACRO(macro,buf,pos,val,len,size) \
{ int l; for (l = 0; l < (len); l++) (val)[l] = macro((buf), (pos) + (size)*l); }
@@ -180,8 +188,6 @@ it also defines lots of intermediate macros, just ignore those :-)
#define PSSVALS(buf,pos,val,len) SSMBMACRO(SSVALS,buf,pos,val,len,2)
#define PSIVALS(buf,pos,val,len) SSMBMACRO(SIVALS,buf,pos,val,len,4)
-#endif
-
/* now the reverse routines - these are used in nmb packets (mostly) */
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
@@ -191,3 +197,4 @@ it also defines lots of intermediate macros, just ignore those :-)
#define RIVAL(buf,pos) IREV(IVAL(buf,pos))
#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
+