4.104.114.84.95
Line | |
---|
1 | /* inline/address.inl |
---|
2 | * |
---|
3 | * This include file contains the bodies of the routines |
---|
4 | * about addresses which are inlined. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1988-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights reserved. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef __INLINE_ADDRESSES_inl |
---|
14 | #define __INLINE_ADDRESSES_inl |
---|
15 | |
---|
16 | /*PAGE |
---|
17 | * |
---|
18 | * _Addresses_Add_offset |
---|
19 | * |
---|
20 | */ |
---|
21 | |
---|
22 | STATIC INLINE void *_Addresses_Add_offset ( |
---|
23 | void *base, |
---|
24 | unsigned32 offset |
---|
25 | ) |
---|
26 | { |
---|
27 | return (base + offset); |
---|
28 | } |
---|
29 | |
---|
30 | /*PAGE |
---|
31 | * |
---|
32 | * _Addresses_Subtract_offset |
---|
33 | * |
---|
34 | */ |
---|
35 | |
---|
36 | STATIC INLINE void *_Addresses_Subtract_offset ( |
---|
37 | void *base, |
---|
38 | unsigned32 offset |
---|
39 | ) |
---|
40 | { |
---|
41 | return (base - offset); |
---|
42 | } |
---|
43 | |
---|
44 | /*PAGE |
---|
45 | * |
---|
46 | * _Addresses_Add |
---|
47 | * |
---|
48 | * NOTE: The cast of an address to an unsigned32 makes this code |
---|
49 | * dependent on an addresses being thirty two bits. |
---|
50 | */ |
---|
51 | |
---|
52 | STATIC INLINE void *_Addresses_Add ( |
---|
53 | void *left, |
---|
54 | void *right |
---|
55 | ) |
---|
56 | { |
---|
57 | return (left + (unsigned32)right); |
---|
58 | } |
---|
59 | |
---|
60 | /*PAGE |
---|
61 | * |
---|
62 | * _Addresses_Subtract |
---|
63 | * |
---|
64 | * NOTE: The cast of an address to an unsigned32 makes this code |
---|
65 | * dependent on an addresses being thirty two bits. |
---|
66 | */ |
---|
67 | |
---|
68 | STATIC INLINE unsigned32 _Addresses_Subtract ( |
---|
69 | void *left, |
---|
70 | void *right |
---|
71 | ) |
---|
72 | { |
---|
73 | return (left - right); |
---|
74 | } |
---|
75 | |
---|
76 | /*PAGE |
---|
77 | * |
---|
78 | * _Addresses_Is_aligned |
---|
79 | * |
---|
80 | */ |
---|
81 | |
---|
82 | STATIC INLINE boolean _Addresses_Is_aligned ( |
---|
83 | void *address |
---|
84 | ) |
---|
85 | { |
---|
86 | return ( ( (unsigned32)address % 4 ) == 0 ); |
---|
87 | } |
---|
88 | |
---|
89 | /*PAGE |
---|
90 | * |
---|
91 | * _Addresses_Is_aligned |
---|
92 | * |
---|
93 | */ |
---|
94 | |
---|
95 | STATIC INLINE boolean _Addresses_Is_in_range ( |
---|
96 | void *address, |
---|
97 | void *base, |
---|
98 | void *limit |
---|
99 | ) |
---|
100 | { |
---|
101 | return ( address >= base && address <= limit ); |
---|
102 | } |
---|
103 | |
---|
104 | #endif |
---|
105 | /* end of include file */ |
---|
Note: See
TracBrowser
for help on using the repository browser.