home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ppc / ppcBitMacs.h < prev    next >
Text File  |  1989-11-07  |  4KB  |  111 lines

  1. /*
  2.  * Copyright IBM Corporation 1987,1988,1989
  3.  *
  4.  * All Rights Reserved
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted,
  8.  * provided that the above copyright notice appear in all copies and that 
  9.  * both that copyright notice and this permission notice appear in
  10.  * supporting documentation, and that the name of IBM not be
  11.  * used in advertising or publicity pertaining to distribution of the
  12.  * software without specific, written prior permission.
  13.  *
  14.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20.  * SOFTWARE.
  21.  *
  22. */
  23. /***********************************************************
  24.         Copyright IBM Corporation 1988
  25.  
  26.                       All Rights Reserved
  27.  
  28. Permission to use, copy, modify, and distribute this software and its 
  29. documentation for any purpose and without fee is hereby granted, 
  30. provided that the above copyright notice appear in all copies and that
  31. both that copyright notice and this permission notice appear in 
  32. supporting documentation, and that the name of IBM not be
  33. used in advertising or publicity pertaining to distribution of the
  34. software without specific, written prior permission.  
  35.  
  36. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  37. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  38. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  39. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  40. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  41. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  42. SOFTWARE.
  43.  
  44. ******************************************************************/
  45.  
  46. /* $Header: /andrew/X11/r3src/release/server/ddx/ibm/ppc/RCS/ppcBitMacs.h,v 9.1 89/04/29 21:25:37 jeff Exp $ */
  47. /* $Source: /andrew/X11/r3src/release/server/ddx/ibm/ppc/RCS/ppcBitMacs.h,v $ */
  48. /* "@(#)ppcbitmacs.h    3.1 88/09/22 09:35:18" */
  49.  
  50. #if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
  51. static char *rcsid = "$Header: /andrew/X11/r3src/release/server/ddx/ibm/ppc/RCS/ppcBitMacs.h,v 9.1 89/04/29 21:25:37 jeff Exp $";
  52. #endif
  53.  
  54. /* Screen Bit-Order Macros */
  55. #if !defined(BITMAP_BIT_ORDER)
  56. #if defined(ibm032) || defined(i386) || defined(iAPX286) || defined(DOS)
  57. #define BITMAP_BIT_ORDER MSBFirst
  58. #else
  59.     ******** ERROR ********
  60. #endif
  61. #endif
  62.  
  63. #if !defined(IMAGE_BYTE_ORDER)
  64. #if defined(ibm032)
  65. #define IMAGE_BYTE_ORDER MSBFirst
  66. #else
  67. #if defined(i386) || defined(iAPX286) || defined(DOS)
  68. #define IMAGE_BYTE_ORDER LSBFirst
  69. #else
  70.     ******** ERROR ********
  71. #endif
  72. #endif
  73. #endif
  74.  
  75. /* Bit Ordering Macros */
  76. #if !defined(BITMAP_BIT_ORDER) || !defined(IMAGE_BYTE_ORDER)
  77. #endif
  78.  
  79. /* Byte Swap Macro */
  80. #if IMAGE_BYTE_ORDER == BITMAP_BIT_ORDER
  81. #define LONG2CHARS( x ) ( x )
  82. #else
  83. #define LONG2CHARS( x )    ( ( ( ( x ) & 0x000000FF ) << 0x18 ) \
  84.             | ( ( ( x ) & 0x0000FF00 ) << 0x08 ) \
  85.             | ( ( ( x ) & 0x00FF0000 ) >> 0x08 ) \
  86.             | ( ( ( x ) & 0xFF000000 ) >> 0x18 ) )
  87. #endif
  88.  
  89. #if !defined(SCRLEFT)
  90. #if (BITMAP_BIT_ORDER == MSBFirst)    /* pc/rt */
  91. #define SCRLEFT( lw, n ) LONG2CHARS( LONG2CHARS( (unsigned ) lw ) << ( n ) )
  92. #else
  93. #if (BITMAP_BIT_ORDER == LSBFirst)    /* intel */
  94. #define SCRLEFT( lw, n ) LONG2CHARS( LONG2CHARS( (unsigned ) lw ) >> ( n ) )
  95. #else
  96.     ******** ERROR ********
  97. #endif
  98. #endif
  99. #endif
  100. #if !defined(SCRRIGHT)
  101. #if (BITMAP_BIT_ORDER == MSBFirst)    /* pc/rt */
  102. #define SCRRIGHT( lw, n ) LONG2CHARS( LONG2CHARS( (unsigned ) lw ) >> ( n ) )
  103. #else
  104. #if (BITMAP_BIT_ORDER == LSBFirst)    /* intel */
  105. #define SCRRIGHT( lw, n ) LONG2CHARS( LONG2CHARS( (unsigned ) lw ) << ( n ) )
  106. #else
  107.     ******** ERROR ********
  108. #endif
  109. #endif
  110. #endif
  111.