Skip to content

Commit 3a6aa1b

Browse files
committed
Memory layouts on union bitfields are terrible.
Signed-off-by: Rich Ercolani <[email protected]>
1 parent 2babd20 commit 3a6aa1b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/sys/zstd/zstd.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,15 @@ typedef struct zfs_zstd_header {
6363
union {
6464
uint32_t raw_version_level;
6565
struct {
66+
#ifdef _ZFS_LITTLE_ENDIAN
6667
uint32_t version : 24;
6768
uint8_t level;
69+
#else
70+
#ifdef _ZFS_BIG_ENDIAN
71+
uint8_t level;
72+
uint32_t version : 24;
73+
#endif
74+
#endif
6875
};
6976
};
7077

0 commit comments

Comments
 (0)