1 | /* macros/address.h |
---|
2 | * |
---|
3 | * This include file contains the bodies of the routines |
---|
4 | * about addresses which are inlined. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __MACROS_ADDRESSES_h |
---|
17 | #define __MACROS_ADDRESSES_h |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * _Addresses_Add_offset |
---|
22 | * |
---|
23 | */ |
---|
24 | |
---|
25 | #define _Addresses_Add_offset( _base, _offset ) \ |
---|
26 | ((void *)((char *)(_base) + (_offset))) |
---|
27 | |
---|
28 | /*PAGE |
---|
29 | * |
---|
30 | * _Addresses_Subtract_offset |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | #define _Addresses_Subtract_offset( _base, _offset ) \ |
---|
35 | ((void *)((char *)(_base) - (_offset))) |
---|
36 | |
---|
37 | /*PAGE |
---|
38 | * |
---|
39 | * _Addresses_Subtract |
---|
40 | * |
---|
41 | * NOTE: The cast of an address to an unsigned32 makes this code |
---|
42 | * dependent on an addresses being thirty two bits. |
---|
43 | */ |
---|
44 | |
---|
45 | #define _Addresses_Subtract( _left, _right ) \ |
---|
46 | ((void *)(_left) - (void *)(_right)) |
---|
47 | |
---|
48 | /*PAGE |
---|
49 | * |
---|
50 | * _Addresses_Is_aligned |
---|
51 | * |
---|
52 | */ |
---|
53 | |
---|
54 | #define _Addresses_Is_aligned( _address ) \ |
---|
55 | ( ( (unsigned32)(_address) % CPU_ALIGNMENT ) == 0 ) |
---|
56 | |
---|
57 | /*PAGE |
---|
58 | * |
---|
59 | * _Addresses_Is_in_range |
---|
60 | * |
---|
61 | */ |
---|
62 | |
---|
63 | #define _Addresses_Is_in_range( _address, _base, _limit ) \ |
---|
64 | ( (_address) >= (_base) && (_address) <= (_limit) ) |
---|
65 | |
---|
66 | #endif |
---|
67 | /* end of include file */ |
---|