1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaacexp.h,v 1.3 2000/01/21 02:30:06 dawes Exp $ */
|
---|
2 |
|
---|
3 |
|
---|
4 | #ifdef HAVE_XORG_CONFIG_H
|
---|
5 | #include <xorg-config.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #include <X11/Xarch.h>
|
---|
9 |
|
---|
10 | #ifndef FIXEDBASE
|
---|
11 | #define CHECKRETURN(b) if(width <= ((b) * 32)) return(base + (b))
|
---|
12 | #else
|
---|
13 | #define CHECKRETURN(b) if(width <= ((b) * 32)) return(base)
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #if X_BYTE_ORDER == X_BIG_ENDIAN
|
---|
17 | # define SHIFT_L(value, shift) ((value) >> (shift))
|
---|
18 | # define SHIFT_R(value, shift) ((value) << (shift))
|
---|
19 | #else
|
---|
20 | # define SHIFT_L(value, shift) ((value) << (shift))
|
---|
21 | # define SHIFT_R(value, shift) ((value) >> (shift))
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #ifndef MSBFIRST
|
---|
25 | # ifdef FIXEDBASE
|
---|
26 | # define WRITE_IN_BITORDER(dest, offset, data) *(dest) = data;
|
---|
27 | # else
|
---|
28 | # define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = data;
|
---|
29 | # endif
|
---|
30 | #else
|
---|
31 | # ifdef FIXEDBASE
|
---|
32 | # define WRITE_IN_BITORDER(dest, offset, data) *(dest) = SWAP_BITS_IN_BYTES(data);
|
---|
33 | # else
|
---|
34 | # define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = SWAP_BITS_IN_BYTES(data)
|
---|
35 | # endif
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #ifdef FIXEDBASE
|
---|
39 | # ifdef MSBFIRST
|
---|
40 | # define WRITE_BITS(b) *base = SWAP_BITS_IN_BYTES(b)
|
---|
41 | # define WRITE_BITS1(b) { \
|
---|
42 | *base = byte_reversed_expand3[(b) & 0xFF] | \
|
---|
43 | byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; }
|
---|
44 | # define WRITE_BITS2(b) { \
|
---|
45 | *base = byte_reversed_expand3[(b) & 0xFF] | \
|
---|
46 | byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
47 | *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
48 | byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; }
|
---|
49 | # define WRITE_BITS3(b) { \
|
---|
50 | *base = byte_reversed_expand3[(b) & 0xFF] | \
|
---|
51 | byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
52 | *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
53 | byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
|
---|
54 | *base = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
|
---|
55 | byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; }
|
---|
56 | # else
|
---|
57 | # define WRITE_BITS(b) *base = (b)
|
---|
58 | # define WRITE_BITS1(b) { \
|
---|
59 | *base = byte_expand3[(b) & 0xFF] | \
|
---|
60 | byte_expand3[((b) & 0xFF00) >> 8] << 24; }
|
---|
61 | # define WRITE_BITS2(b) { \
|
---|
62 | *base = byte_expand3[(b) & 0xFF] | \
|
---|
63 | byte_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
64 | *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
65 | byte_expand3[((b) & 0xFF0000) >> 16] << 16; }
|
---|
66 | # define WRITE_BITS3(b) { \
|
---|
67 | *base = byte_expand3[(b) & 0xFF] | \
|
---|
68 | byte_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
69 | *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
70 | byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
|
---|
71 | *base = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
|
---|
72 | byte_expand3[((b) & 0xFF000000) >> 24] << 8; }
|
---|
73 | # endif
|
---|
74 | #else
|
---|
75 | # ifdef MSBFIRST
|
---|
76 | # define WRITE_BITS(b) *(base++) = SWAP_BITS_IN_BYTES(b)
|
---|
77 | # define WRITE_BITS1(b) { \
|
---|
78 | *(base++) = byte_reversed_expand3[(b) & 0xFF] | \
|
---|
79 | byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; }
|
---|
80 | # define WRITE_BITS2(b) { \
|
---|
81 | *(base) = byte_reversed_expand3[(b) & 0xFF] | \
|
---|
82 | byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
83 | *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
84 | byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
|
---|
85 | base += 2; }
|
---|
86 | # define WRITE_BITS3(b) { \
|
---|
87 | *(base) = byte_reversed_expand3[(b) & 0xFF] | \
|
---|
88 | byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
89 | *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
90 | byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
|
---|
91 | *(base + 2) = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
|
---|
92 | byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; \
|
---|
93 | base += 3; }
|
---|
94 | # else
|
---|
95 | # define WRITE_BITS(b) *(base++) = (b)
|
---|
96 | # define WRITE_BITS1(b) { \
|
---|
97 | *(base++) = byte_expand3[(b) & 0xFF] | \
|
---|
98 | byte_expand3[((b) & 0xFF00) >> 8] << 24; }
|
---|
99 | # define WRITE_BITS2(b) { \
|
---|
100 | *(base) = byte_expand3[(b) & 0xFF] | \
|
---|
101 | byte_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
102 | *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
103 | byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
|
---|
104 | base += 2; }
|
---|
105 | # define WRITE_BITS3(b) { \
|
---|
106 | *(base) = byte_expand3[(b) & 0xFF] | \
|
---|
107 | byte_expand3[((b) & 0xFF00) >> 8] << 24; \
|
---|
108 | *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
|
---|
109 | byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
|
---|
110 | *(base + 2) = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
|
---|
111 | byte_expand3[((b) & 0xFF000000) >> 24] << 8; \
|
---|
112 | base += 3; }
|
---|
113 | # endif
|
---|
114 | #endif
|
---|
115 |
|
---|
116 | #ifdef FIXEDBASE
|
---|
117 | # ifdef MSBFIRST
|
---|
118 | # define EXPNAME(x) x##MSBFirstFixedBase
|
---|
119 | # else
|
---|
120 | # define EXPNAME(x) x##LSBFirstFixedBase
|
---|
121 | # endif
|
---|
122 | #else
|
---|
123 | # ifdef MSBFIRST
|
---|
124 | # define EXPNAME(x) x##MSBFirst
|
---|
125 | # else
|
---|
126 | # define EXPNAME(x) x##LSBFirst
|
---|
127 | # endif
|
---|
128 | #endif
|
---|