]> git.sur5r.net Git - openldap/blob - include/ac/bytes.h
Use LDAP_F and LDAP_P macros.
[openldap] / include / ac / bytes.h
1 /* Generic bytes.h */
2 /*
3  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11
12 #ifndef _AC_BYTES_H
13 #define _AC_BYTES_H
14
15 /* cross compilers should define both AC_INT{2,4}_TYPE in CPPFLAGS */
16
17 #if !defined( AC_INT4_TYPE ) || !defined( AC_INT2_TYPE )
18         /* use autoconf defines to provide sized typedefs */
19 #       if SIZEOF_LONG == 4
20 #               define AC_INT4_TYPE long
21 #       elif SIZEOF_INT == 4
22 #               define AC_INT4_TYPE int
23 #       else
24 #               error "AC_INT4_TYPE?"
25 #       endif
26
27 #       if SIZEOF_SHORT == 2
28 #               define AC_INT2_TYPE short
29 #       elif SIZEOF_INT == 2
30 #               define AC_INT2_TYPE int
31 #       else
32 #               error "AC_INT2_TYPE?"
33 #       endif
34 #endif
35     
36 typedef AC_INT4_TYPE ac_int4;
37 typedef signed AC_INT4_TYPE ac_sint4;
38 typedef unsigned AC_INT4_TYPE ac_uint4;
39
40 typedef AC_INT2_TYPE ac_int2;
41 typedef signed AC_INT2_TYPE ac_sint2;
42 typedef unsigned AC_INT2_TYPE ac_uint2;
43
44 #ifndef BYTE_ORDER
45 /* cross compilers should define BYTE_ORDER in CPPFLAGS */
46
47 /*
48  * Definitions for byte order, according to byte significance from low
49  * address to high.
50  */
51 #define LITTLE_ENDIAN   1234    /* LSB first: i386, vax */
52 #define BIG_ENDIAN  4321        /* MSB first: 68000, ibm, net */
53 #define PDP_ENDIAN  3412        /* LSB first in word, MSW first in long */
54
55 /* assume autoconf's AC_C_BIGENDIAN has been ran */
56 /* if it hasn't, we assume (maybe falsely) the order is LITTLE ENDIAN */
57 #       ifdef WORDS_BIGENDIAN
58 #               define BYTE_ORDER  BIG_ENDIAN
59 #       else
60 #               define BYTE_ORDER  LITTLE_ENDIAN
61 #       endif
62
63 #endif /* BYTE_ORDER */
64
65 #endif /* _AC_BYTES_H */