#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.120 2021/09/24 13:59:19 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.123 2022/09/24 20:30:13 christos Exp $")
#endif
#include <assert.h>
#include <time.h>
#include <ctype.h>
#include <limits.h>
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_BSWAP_H
+#include <sys/bswap.h>
+#endif
#ifndef EFTYPE
#define EFTYPE EINVAL
return calloc(n, u);
}
+#if defined(HAVE_BYTESWAP_H)
+# define _cdf_tole2(x) bswap_16(x)
+# define _cdf_tole4(x) bswap_32(x)
+# define _cdf_tole8(x) bswap_64(x)
+#elif defined(HAVE_SYS_BSWAP_H)
+# define _cdf_tole2(x) bswap16(x)
+# define _cdf_tole4(x) bswap32(x)
+# define _cdf_tole8(x) bswap64(x)
+#else
/*
* swap a short
*/
d[7] = s[0];
return rv;
}
+#endif
/*
* grab a uint32_t from a possibly unaligned address, and return it in