mirror of
https://github.com/vasi/pixz
synced 2024-11-16 21:26:04 +00:00
parent
8d318b90fc
commit
5d831e6d1b
@ -54,6 +54,12 @@ AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([memchr memmove memset strerror strtol])
|
||||
AC_CHECK_DECLS([htole64, le64toh],
|
||||
[],
|
||||
[
|
||||
AC_CHECK_DECLS([htole64, le64toh], [], [], [#include <endian.h>])
|
||||
],
|
||||
[#include <sys/endian.h>])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
|
16
src/endian.c
16
src/endian.c
@ -19,6 +19,22 @@ void xle64enc(uint8_t *d, uint64_t n) {
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_HTOLE64
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define htole64(x) (x)
|
||||
# else
|
||||
# define htole64(x) __bswap_64 (x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_LE64TOH
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define le64toh(x) (x)
|
||||
# else
|
||||
# define le64toh(x) __bswap_64 (x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
uint64_t xle64dec(const uint8_t *d) {
|
||||
return le64toh(*(uint64_t*)d);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user