4.104.114.95
Last change
on this file since 4616790 was
4616790,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/07/07 at 02:42:58
|
Eliminate unsigned8, unsigned16, unsigned32. Use size_t, ptrdiff_t, intptr_t for 64bit compliance.
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
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-2002. |
---|
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 | #include <stddef.h> |
---|
17 | #include <stdint.h> |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * _Addresses_Add_offset |
---|
22 | * |
---|
23 | */ |
---|
24 | |
---|
25 | STATIC INLINE void *_Addresses_Add_offset ( |
---|
26 | void *base, |
---|
27 | size_t offset |
---|
28 | ) |
---|
29 | { |
---|
30 | return (base + offset); |
---|
31 | } |
---|
32 | |
---|
33 | /*PAGE |
---|
34 | * |
---|
35 | * _Addresses_Subtract_offset |
---|
36 | * |
---|
37 | */ |
---|
38 | |
---|
39 | STATIC INLINE void *_Addresses_Subtract_offset ( |
---|
40 | void *base, |
---|
41 | size_t offset |
---|
42 | ) |
---|
43 | { |
---|
44 | return (base - offset); |
---|
45 | } |
---|
46 | |
---|
47 | /*PAGE |
---|
48 | * |
---|
49 | * _Addresses_Add |
---|
50 | * |
---|
51 | * NOTE: The cast of an address to an unsigned32 makes this code |
---|
52 | * dependent on an addresses being thirty two bits. |
---|
53 | */ |
---|
54 | |
---|
55 | STATIC INLINE void *_Addresses_Add ( |
---|
56 | void *left, |
---|
57 | void *right |
---|
58 | ) |
---|
59 | { |
---|
60 | return (left + (ptrdiff_t) right); |
---|
61 | } |
---|
62 | |
---|
63 | /*PAGE |
---|
64 | * |
---|
65 | * _Addresses_Subtract |
---|
66 | * |
---|
67 | * NOTE: The cast of an address to an unsigned32 makes this code |
---|
68 | * dependent on an addresses being thirty two bits. |
---|
69 | */ |
---|
70 | |
---|
71 | STATIC INLINE ptrdiff_t _Addresses_Subtract ( |
---|
72 | void *left, |
---|
73 | void *right |
---|
74 | ) |
---|
75 | { |
---|
76 | return (left - right); |
---|
77 | } |
---|
78 | |
---|
79 | /*PAGE |
---|
80 | * |
---|
81 | * _Addresses_Is_aligned |
---|
82 | * |
---|
83 | */ |
---|
84 | |
---|
85 | STATIC INLINE boolean _Addresses_Is_aligned ( |
---|
86 | void *address |
---|
87 | ) |
---|
88 | { |
---|
89 | return ( ( (intptr_t)address % 4 ) == 0 ); |
---|
90 | } |
---|
91 | |
---|
92 | /*PAGE |
---|
93 | * |
---|
94 | * _Addresses_Is_aligned |
---|
95 | * |
---|
96 | */ |
---|
97 | |
---|
98 | STATIC INLINE boolean _Addresses_Is_in_range ( |
---|
99 | void *address, |
---|
100 | void *base, |
---|
101 | void *limit |
---|
102 | ) |
---|
103 | { |
---|
104 | return ( address >= base && address <= limit ); |
---|
105 | } |
---|
106 | |
---|
107 | #endif |
---|
108 | /* end of include file */ |
---|
Note: See
TracBrowser
for help on using the repository browser.