[BACK]Return to test-betoh64.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / Attic / test-betoh64.c (download)

Revision, Wed Oct 2 21:03:26 2013 UTC (8 years, 3 months ago) by schwarze
Branch: VERSION_1_12
CVS Tags: VERSION_1_12_3, VERSION_1_12_2
Changes since +2 -0 lines

DragonFly needs explicit #include <sys/endian.h> to use be64toh(),
while most other systems include that indirectly via <sys/types.h>.
Reported by Franco Fichtner <franco at lastsummer dot de>.

#include <sys/types.h>

#if defined(__linux__)
# include <endian.h>
#elif defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# include <sys/endian.h>

main(int argc, char **argv)
	u_int64_t hostorder;
	u_int64_t bigendian = 1;
	hostorder = betoh64(bigendian);
	return 0;