[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 1.1.2.2, Wed Oct 2 21:03:26 2013 UTC (10 years, 5 months ago) by schwarze
Branch: VERSION_1_12
CVS Tags: VERSION_1_12_3, VERSION_1_12_2
Changes since 1.1.2.1: +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>
#else
# include <sys/endian.h>
#endif

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