]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Define BE_IN16 & BE_IN32 for lz4 compression
authorEric Dillmann <eric@jave.fr>
Mon, 28 Jan 2013 22:48:11 +0000 (23:48 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 29 Jan 2013 17:30:23 +0000 (09:30 -0800)
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>
include/sys/byteorder.h

index 30700f6b3ab5abd35a55d5141f5c6fed0245cb36..d09f5bf3ea17f42c556f6c693b72f9b1ec8044db 100644 (file)
 #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 */