Combine linux and BSD endian code

pull/1/merge
Dave Vasilevsky 12 years ago
parent 8c4ae8b0d6
commit 034805e2a6

@ -10,19 +10,21 @@ void xle64enc(uint8_t *d, uint64_t n) {
OSWriteLittleInt64(d, 0, n);
}
#elif defined(__linux__) || defined(__FreeBSD__)
#elif defined(__linux__)
#define _BSD_SOURCE
#include <stdint.h>
#include <asm/byteorder.h>
#ifdef __linux__
#include <endian.h>
#else
#include <sys/endian.h>
#endif
uint64_t xle64dec(const uint8_t *d) {
return __le64_to_cpu(*(uint64_t*)d);
return le64toh(*(uint64_t*)d);
}
void xle64enc(uint8_t *d, uint64_t n) {
*(uint64_t*)d = __cpu_to_le64(n);
*(uint64_t*)d = htole64(n);
}
#else

Loading…
Cancel
Save