2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1996-2009 Oracle. All rights reserved.
15 * Return 1 if big-endian (Motorola and Sparc), not little-endian
16 * (Intel and Vax). We do this work at run-time, rather than at
17 * configuration time so cross-compilation and general embedded
18 * system support is simpler.
20 * PUBLIC: int __db_isbigendian __P((void));
25 union { /* From Harbison & Steele. */
31 return (u.c[sizeof(long) - 1] == 1);
36 * Return if we need to do byte swapping, checking for illegal
39 * PUBLIC: int __db_byteorder __P((ENV *, int));
42 __db_byteorder(env, lorder)
50 if (!F_ISSET(env, ENV_LITTLEENDIAN))
51 return (DB_SWAPBYTES);
54 if (F_ISSET(env, ENV_LITTLEENDIAN))
55 return (DB_SWAPBYTES);
59 "unsupported byte order, only big and little-endian supported");