Define BE_IN16 & BE_IN32 for lz4 compression

The new lz4 compression algorithm, zfsonlinux/zfs@9759c60, requires
the generic BE_IN16 and BE_IN32 functions.  These are added to the SPL
for other consumers to take advantage of.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Eric Dillmann 2013-01-28 23:48:11 +01:00 committed by Brian Behlendorf
parent 0936c3449f
commit 3cbfd259b7

View File

@ -34,4 +34,13 @@
#define BE_32(x) cpu_to_be32(x)
#define BE_64(x) cpu_to_be64(x)
#define BE_IN8(xa) \
*((uint8_t *)(xa))
#define BE_IN16(xa) \
(((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1))
#define BE_IN32(xa) \
(((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2))
#endif /* SPL_BYTEORDER_H */