1998-11-18 06:49:15 +08:00
|
|
|
/* Generic bytes.h */
|
1999-08-30 16:08:00 +08:00
|
|
|
/* $OpenLDAP$ */
|
1998-12-29 03:51:35 +08:00
|
|
|
/*
|
2000-05-13 10:25:54 +08:00
|
|
|
* Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
|
1998-12-29 03:51:35 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted only
|
|
|
|
* as authorized by the OpenLDAP Public License. A copy of this
|
|
|
|
* license is available at http://www.OpenLDAP.org/license.html or
|
|
|
|
* in file LICENSE in the top-level directory of the distribution.
|
|
|
|
*/
|
1998-11-18 06:49:15 +08:00
|
|
|
|
|
|
|
#ifndef _AC_BYTES_H
|
|
|
|
#define _AC_BYTES_H
|
|
|
|
|
1999-05-31 13:39:10 +08:00
|
|
|
/* cross compilers should define both AC_INT{2,4}_TYPE in CPPFLAGS */
|
1998-11-18 06:49:15 +08:00
|
|
|
|
1999-11-17 10:04:06 +08:00
|
|
|
#if !defined( AC_INT4_TYPE )
|
1998-11-18 06:49:15 +08:00
|
|
|
/* use autoconf defines to provide sized typedefs */
|
|
|
|
# if SIZEOF_LONG == 4
|
1999-05-31 13:39:10 +08:00
|
|
|
# define AC_INT4_TYPE long
|
1998-11-18 06:49:15 +08:00
|
|
|
# elif SIZEOF_INT == 4
|
1999-05-31 13:39:10 +08:00
|
|
|
# define AC_INT4_TYPE int
|
1999-10-30 10:53:24 +08:00
|
|
|
# elif SIZEOF_SHORT == 4
|
|
|
|
# define AC_INT4_TYPE short
|
1999-05-31 13:39:10 +08:00
|
|
|
# else
|
2001-05-03 03:48:40 +08:00
|
|
|
/* used by SHA-1, but commented out */
|
|
|
|
/* # error "AC_INT2_TYPE?" */
|
1998-11-18 06:49:15 +08:00
|
|
|
# endif
|
1999-11-17 10:04:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef AC_INT4_TYPE ac_int4;
|
|
|
|
typedef signed AC_INT4_TYPE ac_sint4;
|
|
|
|
typedef unsigned AC_INT4_TYPE ac_uint4;
|
1998-11-18 06:49:15 +08:00
|
|
|
|
1999-12-19 03:49:39 +08:00
|
|
|
#if !defined( AC_INT2_TYPE )
|
1998-11-18 06:49:15 +08:00
|
|
|
# if SIZEOF_SHORT == 2
|
1999-05-31 13:39:10 +08:00
|
|
|
# define AC_INT2_TYPE short
|
1998-11-18 06:49:15 +08:00
|
|
|
# elif SIZEOF_INT == 2
|
1999-05-31 13:39:10 +08:00
|
|
|
# define AC_INT2_TYPE int
|
1999-10-30 10:53:24 +08:00
|
|
|
# elif SIZEOF_LONG == 2
|
|
|
|
# define AC_INT2_TYPE long
|
1999-05-31 13:39:10 +08:00
|
|
|
# else
|
1999-11-17 10:04:06 +08:00
|
|
|
/* not used, no error */
|
|
|
|
/* # error "AC_INT2_TYPE?" */
|
1998-11-18 06:49:15 +08:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
1999-11-17 10:04:06 +08:00
|
|
|
#if defined( AC_INT2_TYPE )
|
1999-05-31 13:39:10 +08:00
|
|
|
typedef AC_INT2_TYPE ac_int2;
|
|
|
|
typedef signed AC_INT2_TYPE ac_sint2;
|
|
|
|
typedef unsigned AC_INT2_TYPE ac_uint2;
|
1999-11-17 10:04:06 +08:00
|
|
|
#endif
|
1999-05-31 13:39:10 +08:00
|
|
|
|
1998-11-18 06:49:15 +08:00
|
|
|
#ifndef BYTE_ORDER
|
|
|
|
/* cross compilers should define BYTE_ORDER in CPPFLAGS */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definitions for byte order, according to byte significance from low
|
|
|
|
* address to high.
|
|
|
|
*/
|
|
|
|
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
|
|
|
|
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
|
|
|
|
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
|
|
|
|
|
|
|
|
/* assume autoconf's AC_C_BIGENDIAN has been ran */
|
|
|
|
/* if it hasn't, we assume (maybe falsely) the order is LITTLE ENDIAN */
|
|
|
|
# ifdef WORDS_BIGENDIAN
|
|
|
|
# define BYTE_ORDER BIG_ENDIAN
|
|
|
|
# else
|
|
|
|
# define BYTE_ORDER LITTLE_ENDIAN
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#endif /* BYTE_ORDER */
|
|
|
|
|
|
|
|
#endif /* _AC_BYTES_H */
|