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