/* Generic bytes.h */1/* $OpenLDAP$ */2/* This work is part of OpenLDAP Software <http://www.openldap.org/>.3*4* Copyright 1998-2024 The OpenLDAP Foundation.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted only as authorized by the OpenLDAP9* Public License.10*11* A copy of this license is available in file LICENSE in the12* top-level directory of the distribution or, alternatively, at13* <http://www.OpenLDAP.org/license.html>.14*/1516#ifndef _AC_BYTES_H17#define _AC_BYTES_H1819/* cross compilers should define both AC_INT{2,4}_TYPE in CPPFLAGS */2021#if !defined( AC_INT4_TYPE )22/* use autoconf defines to provide sized typedefs */23# if SIZEOF_LONG == 424# define AC_INT4_TYPE long25# elif SIZEOF_INT == 426# define AC_INT4_TYPE int27# elif SIZEOF_SHORT == 428# define AC_INT4_TYPE short29# else30# error "AC_INT4_TYPE?"31# endif32#endif3334typedef AC_INT4_TYPE ac_int4;35typedef signed AC_INT4_TYPE ac_sint4;36typedef unsigned AC_INT4_TYPE ac_uint4;3738#if !defined( AC_INT2_TYPE )39# if SIZEOF_SHORT == 240# define AC_INT2_TYPE short41# elif SIZEOF_INT == 242# define AC_INT2_TYPE int43# elif SIZEOF_LONG == 244# define AC_INT2_TYPE long45# else46# error "AC_INT2_TYPE?"47# endif48#endif4950#if defined( AC_INT2_TYPE )51typedef AC_INT2_TYPE ac_int2;52typedef signed AC_INT2_TYPE ac_sint2;53typedef unsigned AC_INT2_TYPE ac_uint2;54#endif5556#ifndef BYTE_ORDER57/* cross compilers should define BYTE_ORDER in CPPFLAGS */5859/*60* Definitions for byte order, according to byte significance from low61* address to high.62*/63#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */64#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */65#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */6667/* assume autoconf's AC_C_BIGENDIAN has been ran */68/* if it hasn't, we assume (maybe falsely) the order is LITTLE ENDIAN */69# ifdef WORDS_BIGENDIAN70# define BYTE_ORDER BIG_ENDIAN71# else72# define BYTE_ORDER LITTLE_ENDIAN73# endif7475#endif /* BYTE_ORDER */7677#endif /* _AC_BYTES_H */787980