home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / lib / H / tmp / align.h next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.0 KB  |  43 lines

  1. #ifndef    _ALIGN_H_
  2. #define    _ALIGN_H_    "$Header: /private/postgres/src/lib/H/tmp/RCS/align.h,v 1.5 1991/06/18 23:28:24 cimarron Exp $"
  3.  
  4. /*
  5.  *    align.h        - alignment macros
  6.  */
  7.  
  8. /*
  9.  *    SHORTALIGN(LEN)    - length (or address) aligned for shorts
  10.  */
  11. #define    SHORTALIGN(LEN)\
  12.     (((long)(LEN) + 1) & ~01)
  13.  
  14. /*
  15.  *    LONGALIGN(LEN)    - length (or address) aligned for longs
  16.  */
  17. #if defined(sun) && ! defined(sparc)
  18. #define    LONGALIGN(LEN)    SHORTALIGN(LEN)
  19. #else 
  20. #define    LONGALIGN(LEN)\
  21.     (((long)(LEN) + 3) & ~03)
  22. #endif
  23.  
  24. /* ----------------
  25.  *    the reverse alignment macros are for use with the executor
  26.  *    shared memory allocator's ExecSMHighAlloc routine which
  27.  *    allocates memory from the high-area "down" to the low-area.
  28.  *    In this case we need alignment in the "other" direction than
  29.  *    provided by SHORTALIGN and LONGALIGN
  30.  * ----------------
  31.  */
  32. #define    REVERSESHORTALIGN(LEN)\
  33.     (((long)(LEN)) & ~01)
  34.  
  35. #if defined(sun) && ! defined(sparc)
  36. #define    REVERSELONGALIGN(LEN)    REVERSESHORTALIGN(LEN)
  37. #else
  38. #define    REVERSELONGALIGN(LEN)\
  39.     (((long)(LEN)) & ~03)
  40. #endif
  41.  
  42. #endif
  43.