Skip to content

Commit

Permalink
core: added a byte order detection abstraction macro
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Aug 9, 2024
1 parent f9e6def commit f2f6b1d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/fluent-bit/flb_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,17 @@
#define be64toh(x) OSSwapBigToHostInt64(x)
#endif

#define FLB_LITTLE_ENDIAN 0
#define FLB_BIG_ENDIAN 1

#ifndef FLB_BYTE_ORDER
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define FLB_BYTE_ORDER FLB_BIG_ENDIAN
#elif defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || defined(_BIG_ENDIAN)
#define FLB_BYTE_ORDER FLB_BIG_ENDIAN
#else
#define FLB_BYTE_ORDER FLB_LITTLE_ENDIAN
#endif
#endif

#endif

0 comments on commit f2f6b1d

Please sign in to comment.