Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Fix compilation in the mingw environment
Browse files Browse the repository at this point in the history
endian.h doesn't exists in mingw, and we emulate the necessary value
(i.e. BYTE_ORDER and LITTLE_ENDIAN) directly in a #ifdef __MINGW32__.
note that in mingw32 we hardcode the endianness to little endian.

Contributed-by: Henk-Jan van Tuyl
  • Loading branch information
vincenthz committed Aug 20, 2010
1 parent e74a479 commit 378d1ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cbits/bitfn.h
Expand Up @@ -158,8 +158,13 @@ static inline void array_copy64(uint64_t *d, uint64_t *s, uint32_t nb)
}
#endif

#ifdef __MINGW32__
# define LITTLE_ENDIAN 1234
# define BYTE_ORDER LITTLE_ENDIAN
#else
# include <endian.h>
#endif
/* big endian to cpu */
#include <endian.h>
#if LITTLE_ENDIAN == BYTE_ORDER

# define be32_to_cpu(a) swap32(a)
Expand Down

0 comments on commit 378d1ca

Please sign in to comment.