mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
lib:util: Add comments to use bytearray.h to byteorder.h
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
83cb44dbe8
commit
fc4064eae6
@ -90,11 +90,23 @@ it also defines lots of intermediate macros, just ignore those :-)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* ATTENTION: Do not use those macros anymore, use the ones from bytearray.h
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#define CVAL(buf,pos) ((uint32_t)_DATA_BYTE_CONST(buf, pos))
|
#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 CVAL_NC(buf,pos) _DATA_BYTE(buf, pos) /* Non-const version of CVAL */
|
||||||
#define PVAL(buf,pos) (CVAL(buf,pos))
|
#define PVAL(buf,pos) (CVAL(buf,pos))
|
||||||
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
|
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* ATTENTION: Do not use those macros anymore, use the ones from bytearray.h
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#define SVAL(buf,pos) (uint32_t)PULL_LE_U16(buf, pos)
|
#define SVAL(buf,pos) (uint32_t)PULL_LE_U16(buf, pos)
|
||||||
#define IVAL(buf,pos) PULL_LE_U32(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 SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(uint8_t)((val)&0xFF),CVAL_NC(buf,pos+1)=(uint8_t)((val)>>8))
|
||||||
@ -106,17 +118,35 @@ it also defines lots of intermediate macros, just ignore those :-)
|
|||||||
#define SSVALS(buf,pos,val) PUSH_LE_U16(buf, pos, val)
|
#define SSVALS(buf,pos,val) PUSH_LE_U16(buf, pos, val)
|
||||||
#define SIVALS(buf,pos,val) PUSH_LE_U32(buf, pos, val)
|
#define SIVALS(buf,pos,val) PUSH_LE_U32(buf, pos, val)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* ATTENTION: Do not use those macros anymore, use the ones from bytearray.h
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
/* 64 bit macros */
|
/* 64 bit macros */
|
||||||
#define BVAL(p, ofs) PULL_LE_U64(p, ofs)
|
#define BVAL(p, ofs) PULL_LE_U64(p, ofs)
|
||||||
#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
|
#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
|
||||||
#define SBVAL(p, ofs, v) PUSH_LE_U64(p, ofs, v)
|
#define SBVAL(p, ofs, v) PUSH_LE_U64(p, ofs, v)
|
||||||
#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
|
#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* ATTENTION: Do not use those macros anymore, use the ones from bytearray.h
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
/* now the reverse routines - these are used in nmb packets (mostly) */
|
/* now the reverse routines - these are used in nmb packets (mostly) */
|
||||||
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
|
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
|
||||||
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
|
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
|
||||||
#define BREV(x) ((IREV((uint64_t)x)<<32) | (IREV(((uint64_t)x)>>32)))
|
#define BREV(x) ((IREV((uint64_t)x)<<32) | (IREV(((uint64_t)x)>>32)))
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* ATTENTION: Do not use those macros anymore, use the ones from bytearray.h
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#define RSVAL(buf,pos) (uint32_t)PULL_BE_U16(buf, pos)
|
#define RSVAL(buf,pos) (uint32_t)PULL_BE_U16(buf, pos)
|
||||||
#define RSVALS(buf,pos) PULL_BE_U16(buf, pos)
|
#define RSVALS(buf,pos) PULL_BE_U16(buf, pos)
|
||||||
#define RIVAL(buf,pos) PULL_BE_U32(buf, pos)
|
#define RIVAL(buf,pos) PULL_BE_U32(buf, pos)
|
||||||
@ -130,4 +160,10 @@ it also defines lots of intermediate macros, just ignore those :-)
|
|||||||
#define RSBVAL(buf,pos,val) PUSH_BE_U64(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)
|
#define RSBVALS(buf,pos,val) PUSH_BE_U64(buf, pos, val)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* ATTENTION: Do not use those macros anymore, use the ones from bytearray.h
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#endif /* _BYTEORDER_H */
|
#endif /* _BYTEORDER_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user