home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ldapsdk.zip / include / ac / bytes.h < prev    next >
C/C++ Source or Header  |  2001-05-30  |  2KB  |  77 lines

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