. pci driver now returns devices, even when they have been pci_reserve()d
[minix3.git] / lib / float / get_put.h
blob9fd7f606fdf953366ab1f8f4ec8b9acef73e4507
1 /*
2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
6 /* $Header$ */
8 #include <byte_order.h>
10 #if CHAR_UNSIGNED
11 #define Xchar(ch) (ch)
12 #else
13 #define Xchar(ch) ((ch) & 0377)
14 #endif
16 #define BYTES_REVERSED (MSB_AT_LOW_ADDRESS != FL_MSB_AT_LOW_ADDRESS)
17 #define WORDS_REVERSED (MSW_AT_LOW_ADDRESS != FL_MSW_AT_LOW_ADDRESS)
18 #define LONGS_REVERSED (FL_MSL_AT_LOW_ADDRESS)
20 #if BYTES_REVERSED
21 #define uget2(c) (Xchar((c)[1]) | ((unsigned) Xchar((c)[0]) << 8))
22 #define Xput2(i, c) (((c)[1] = (i)), ((c)[0] = (i) >> 8))
23 #define put2(i, c) { register int j = (i); Xput2(j, c); }
24 #else
25 #define uget2(c) (* ((unsigned short *) (c)))
26 #define Xput2(i, c) (* ((short *) (c)) = (i))
27 #define put2(i, c) Xput2(i, c)
28 #endif
30 #define get2(c) ((short) uget2(c))
32 #if WORDS_REVERSED || BYTES_REVERSED
33 #define get4(c) (uget2((c)+2) | ((long) uget2(c) << 16))
34 #define put4(l, c) { register long x=(l); \
35 Xput2((int)x,(c)+2); \
36 Xput2((int)(x>>16),(c)); \
38 #else
39 #define get4(c) (* ((long *) (c)))
40 #define put4(l, c) (* ((long *) (c)) = (l))
41 #endif