source: rtems/cpukit/score/inline/rtems/score/address.inl @ 1a8fde6c

4.104.114.84.95
Last change on this file since 1a8fde6c was 1a8fde6c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/06/96 at 21:34:57

Removed prototyes for static inline routines and moved the comments into
the inline implementation. The impetus for this was twofold. First,
it is incorrect to have static inline prototypes when using the macro
implementation. Second, this reduced the number of lines in the include
files seen by rtems.h by about 2000 lines.

Next we restricted visibility for the inline routines to inside the
executive itself EXCEPT for a handful of objects. This reduced the
number of include files included by rtems.h by 40 files and reduced
the lines in the include files seen by rtems.h by about 6000 lines.

In total, these reduced the compile time of the entire RTEMS tree by 20%.
This results in about 8 minutes savings on the SparcStation? 10 morgana.

  • Property mode set to 100644
File size: 2.7 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) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __INLINE_ADDRESSES_inl
18#define __INLINE_ADDRESSES_inl
19
20/*PAGE
21 *
22 *  _Addresses_Add_offset
23 *
24 *  DESCRIPTION:
25 *
26 *  This function is used to add an offset to a base address.
27 *  It returns the resulting address.  This address is typically
28 *  converted to an access type before being used further.
29 */
30
31STATIC INLINE void *_Addresses_Add_offset (
32  void       *base,
33  unsigned32  offset
34)
35{
36  return (void *)((char *)base + offset);
37}
38
39/*PAGE
40 *
41 *  _Addresses_Subtract_offset
42 *
43 *  DESCRIPTION:
44 *
45 *  This function is used to subtract an offset from a base
46 *  address.  It returns the resulting address.  This address is
47 *  typically converted to an access type before being used further.
48 */
49
50STATIC INLINE void *_Addresses_Subtract_offset (
51  void       *base,
52  unsigned32  offset
53)
54{
55  return (void *)((char *)base - offset);
56}
57
58/*PAGE
59 *
60 *  _Addresses_Subtract
61 *
62 *  DESCRIPTION:
63 *
64 *  This function is used to subtract two addresses.  It returns the
65 *  resulting offset.
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
71STATIC INLINE unsigned32 _Addresses_Subtract (
72  void *left,
73  void *right
74)
75{
76  return ((char *) left - (char *) right);
77}
78
79/*PAGE
80 *
81 *  _Addresses_Is_aligned
82 *
83 *  DESCRIPTION:
84 *
85 *  This function returns TRUE if the given address is correctly
86 *  aligned for this processor and FALSE otherwise.  Proper alignment
87 *  is based on correctness and efficiency.
88 */
89
90STATIC INLINE boolean _Addresses_Is_aligned (
91  void *address
92)
93{
94    return ( ( (unsigned32)address % CPU_ALIGNMENT ) == 0 );
95}
96
97/*PAGE
98 *
99 *  _Addresses_Is_in_range
100 *
101 *  DESCRIPTION:
102 *
103 *  This function returns TRUE if the given address is within the
104 *  memory range specified and FALSE otherwise.  base is the address
105 *  of the first byte in the memory range and limit is the address
106 *  of the last byte in the memory range.  The base address is
107 *  assumed to be lower than the limit address.
108 */
109
110STATIC INLINE boolean _Addresses_Is_in_range (
111  void *address,
112  void *base,
113  void *limit
114)
115{
116  return ( address >= base && address <= limit );
117}
118
119#endif
120/* end of include file */
Note: See TracBrowser for help on using the repository browser.