moved the array macros outside of the CAREFUL_ALIGNMENT define.
authorLuke Leighton <lkcl@samba.org>
Thu, 9 Oct 1997 15:51:43 +0000 (15:51 +0000)
committerLuke Leighton <lkcl@samba.org>
Thu, 9 Oct 1997 15:51:43 +0000 (15:51 +0000)
(This used to be commit d9fcf11aa04ff04dcbccd628322240f8324ae51d)

source3/include/byteorder.h

index 4991338f2636900a9c34fb9be25aadc54bdc8bb5..0664a338175aaeeb02202348105ea1ff846f6b98 100644 (file)
@@ -128,6 +128,7 @@ it also defines lots of intermediate macros, just ignore those :-)
 
 
 #if CAREFUL_ALIGNMENT
 
 
 #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)
 #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)))
 #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
 #else
+
 /* this handles things for architectures like the 386 that can handle
    alignment errors */
 /*
 /* 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))
 
 #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); }
 
 #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)
 
 #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))
 
 /* 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))
 #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))
+