Skip to content

Commit 7148a13

Browse files
thesamesamderselbst
authored andcommitted
utils: fix big endian path for cpp11 implementation
Copying the implementation from embedded (091e849) is sufficient here. Reported by ernsteiswuerfel at https://bugs.gentoo.org/973126.
1 parent 57c1952 commit 7148a13

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/utils/fluid_sys_cpp11.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,17 @@ extern "C" {
4646
#endif
4747

4848
/* Endian detection */
49+
#ifdef WORDS_BIGENDIAN
50+
#define FLUID_IS_BIG_ENDIAN true
51+
52+
#define FLUID_LE32TOH(x) (((0xFF000000 & (x)) >> 24) | ((0x00FF0000 & (x)) >> 8) | ((0x0000FF00 & (x)) << 8) | ((0x000000FF & (x)) << 24));
53+
#define FLUID_LE16TOH(x) (((0xFF00 & (x)) >> 8) | ((0x00FF & (x)) << 8))
54+
#else
4955
#define FLUID_IS_BIG_ENDIAN false
5056

5157
#define FLUID_LE32TOH(x) (x)
5258
#define FLUID_LE16TOH(x) (x)
59+
#endif
5360

5461
/*
5562
* Utility functions

0 commit comments

Comments
 (0)