source: rtems/doc/tools/bmenu/address.inl @ 1e524995

4.104.114.84.95
Last change on this file since 1e524995 was 1e524995, checked in by Joel Sherrill <joel.sherrill@…>, on 02/06/98 at 14:14:30

Updated copyrights

  • 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-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
22STATIC 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
36STATIC 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
52STATIC 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
68STATIC 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
82STATIC 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
95STATIC 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.