@@ -14,7 +14,8 @@ namespace snmalloc
1414 /* *
1515 * Perform arithmetic on a uintptr_t.
1616 */
17- inline uintptr_t pointer_offset (uintptr_t base, size_t diff)
17+ SNMALLOC_FAST_PATH_INLINE uintptr_t
18+ pointer_offset (uintptr_t base, size_t diff)
1819 {
1920 return base + diff;
2021 }
@@ -23,15 +24,15 @@ namespace snmalloc
2324 * Perform pointer arithmetic and return the adjusted pointer.
2425 */
2526 template <typename U = void , typename T>
26- inline U* pointer_offset (T* base, size_t diff)
27+ SNMALLOC_FAST_PATH_INLINE U* pointer_offset (T* base, size_t diff)
2728 {
2829 SNMALLOC_ASSERT (base != nullptr ); /* Avoid UB */
2930 return unsafe_from_uintptr<U>(
3031 unsafe_to_uintptr<T>(base) + static_cast <uintptr_t >(diff));
3132 }
3233
3334 template <SNMALLOC_CONCEPT(capptr::IsBound) bounds, typename T>
34- inline CapPtr<void , bounds>
35+ SNMALLOC_FAST_PATH_INLINE CapPtr<void , bounds>
3536 pointer_offset (CapPtr<T, bounds> base, size_t diff)
3637 {
3738 return CapPtr<void , bounds>::unsafe_from (
@@ -42,14 +43,14 @@ namespace snmalloc
4243 * Perform pointer arithmetic and return the adjusted pointer.
4344 */
4445 template <typename U = void , typename T>
45- inline U* pointer_offset_signed (T* base, ptrdiff_t diff)
46+ SNMALLOC_FAST_PATH_INLINE U* pointer_offset_signed (T* base, ptrdiff_t diff)
4647 {
4748 SNMALLOC_ASSERT (base != nullptr ); /* Avoid UB */
4849 return reinterpret_cast <U*>(reinterpret_cast <char *>(base) + diff);
4950 }
5051
5152 template <SNMALLOC_CONCEPT(capptr::IsBound) bounds, typename T>
52- inline CapPtr<void , bounds>
53+ SNMALLOC_FAST_PATH_INLINE CapPtr<void , bounds>
5354 pointer_offset_signed (CapPtr<T, bounds> base, ptrdiff_t diff)
5455 {
5556 return CapPtr<void , bounds>::unsafe_from (
@@ -60,7 +61,7 @@ namespace snmalloc
6061 * Cast from a pointer type to an address.
6162 */
6263 template <typename T>
63- inline SNMALLOC_FAST_PATH address_t address_cast (T* ptr)
64+ SNMALLOC_FAST_PATH_INLINE address_t address_cast (T* ptr)
6465 {
6566 return reinterpret_cast <address_t >(ptr);
6667 }
@@ -73,12 +74,12 @@ namespace snmalloc
7374 * capptr_bound.
7475 */
7576 template <typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
76- inline SNMALLOC_FAST_PATH address_t address_cast (CapPtr<T, bounds> a)
77+ SNMALLOC_FAST_PATH_INLINE address_t address_cast (CapPtr<T, bounds> a)
7778 {
7879 return address_cast (a.unsafe_ptr ());
7980 }
8081
81- inline SNMALLOC_FAST_PATH address_t address_cast (uintptr_t a)
82+ SNMALLOC_FAST_PATH_INLINE address_t address_cast (uintptr_t a)
8283 {
8384 return static_cast <address_t >(a);
8485 }
@@ -88,15 +89,15 @@ namespace snmalloc
8889 * two.
8990 */
9091 template <size_t alignment>
91- static inline bool is_aligned_block (address_t p, size_t size)
92+ SNMALLOC_FAST_PATH_INLINE bool is_aligned_block (address_t p, size_t size)
9293 {
9394 static_assert (bits::is_pow2 (alignment));
9495
9596 return ((p | size) & (alignment - 1 )) == 0 ;
9697 }
9798
9899 template <size_t alignment>
99- static inline bool is_aligned_block (void * p, size_t size)
100+ SNMALLOC_FAST_PATH_INLINE bool is_aligned_block (void * p, size_t size)
100101 {
101102 return is_aligned_block<alignment>(address_cast (p), size);
102103 }
@@ -106,7 +107,7 @@ namespace snmalloc
106107 * a power of two.
107108 */
108109 template <size_t alignment>
109- inline uintptr_t pointer_align_down (uintptr_t p)
110+ SNMALLOC_FAST_PATH_INLINE uintptr_t pointer_align_down (uintptr_t p)
110111 {
111112 static_assert (alignment > 0 );
112113 static_assert (bits::is_pow2 (alignment));
@@ -127,7 +128,7 @@ namespace snmalloc
127128 * power of two.
128129 */
129130 template <size_t alignment, typename T = void >
130- inline T* pointer_align_down (void * p)
131+ SNMALLOC_FAST_PATH_INLINE T* pointer_align_down (void * p)
131132 {
132133 return unsafe_from_uintptr<T>(
133134 pointer_align_down<alignment>(unsafe_to_uintptr<void >(p)));
@@ -137,14 +138,15 @@ namespace snmalloc
137138 size_t alignment,
138139 typename T,
139140 SNMALLOC_CONCEPT (capptr::IsBound) bounds>
140- inline CapPtr<T, bounds> pointer_align_down (CapPtr<void , bounds> p)
141+ SNMALLOC_FAST_PATH_INLINE CapPtr<T, bounds>
142+ pointer_align_down (CapPtr<void , bounds> p)
141143 {
142144 return CapPtr<T, bounds>::unsafe_from (
143145 pointer_align_down<alignment, T>(p.unsafe_ptr ()));
144146 }
145147
146148 template <size_t alignment>
147- inline address_t address_align_down (address_t p)
149+ SNMALLOC_FAST_PATH_INLINE address_t address_align_down (address_t p)
148150 {
149151 return bits::align_down (p, alignment);
150152 }
@@ -154,7 +156,7 @@ namespace snmalloc
154156 * power of two.
155157 */
156158 template <size_t alignment, typename T = void >
157- inline T* pointer_align_up (void * p)
159+ SNMALLOC_FAST_PATH_INLINE T* pointer_align_up (void * p)
158160 {
159161 static_assert (alignment > 0 );
160162 static_assert (bits::is_pow2 (alignment));
@@ -175,14 +177,15 @@ namespace snmalloc
175177 size_t alignment,
176178 typename T = void ,
177179 SNMALLOC_CONCEPT (capptr::IsBound) bounds>
178- inline CapPtr<T, bounds> pointer_align_up (CapPtr<void , bounds> p)
180+ SNMALLOC_FAST_PATH_INLINE CapPtr<T, bounds>
181+ pointer_align_up (CapPtr<void , bounds> p)
179182 {
180183 return CapPtr<T, bounds>::unsafe_from (
181184 pointer_align_up<alignment, T>(p.unsafe_ptr ()));
182185 }
183186
184187 template <size_t alignment>
185- inline address_t address_align_up (address_t p)
188+ SNMALLOC_FAST_PATH_INLINE address_t address_align_up (address_t p)
186189 {
187190 return bits::align_up (p, alignment);
188191 }
@@ -192,7 +195,7 @@ namespace snmalloc
192195 * a power of two.
193196 */
194197 template <typename T = void >
195- inline T* pointer_align_down (void * p, size_t alignment)
198+ SNMALLOC_FAST_PATH_INLINE T* pointer_align_down (void * p, size_t alignment)
196199 {
197200 SNMALLOC_ASSERT (alignment > 0 );
198201 SNMALLOC_ASSERT (bits::is_pow2 (alignment));
@@ -205,7 +208,7 @@ namespace snmalloc
205208 }
206209
207210 template <typename T = void , SNMALLOC_CONCEPT(capptr::IsBound) bounds>
208- inline CapPtr<T, bounds>
211+ SNMALLOC_FAST_PATH_INLINE CapPtr<T, bounds>
209212 pointer_align_down (CapPtr<void , bounds> p, size_t alignment)
210213 {
211214 return CapPtr<T, bounds>::unsafe_from (
@@ -217,7 +220,7 @@ namespace snmalloc
217220 * be a power of two.
218221 */
219222 template <typename T = void >
220- inline T* pointer_align_up (void * p, size_t alignment)
223+ SNMALLOC_FAST_PATH_INLINE T* pointer_align_up (void * p, size_t alignment)
221224 {
222225 SNMALLOC_ASSERT (alignment > 0 );
223226 SNMALLOC_ASSERT (bits::is_pow2 (alignment));
@@ -230,7 +233,7 @@ namespace snmalloc
230233 }
231234
232235 template <typename T = void , SNMALLOC_CONCEPT(capptr::IsBound) bounds>
233- inline CapPtr<T, bounds>
236+ SNMALLOC_FAST_PATH_INLINE CapPtr<T, bounds>
234237 pointer_align_up (CapPtr<void , bounds> p, size_t alignment)
235238 {
236239 return CapPtr<T, bounds>::unsafe_from (
@@ -242,7 +245,8 @@ namespace snmalloc
242245 * expected to point to the base of some (sub)allocation into which cursor
243246 * points; would-be negative answers trip an assertion in debug builds.
244247 */
245- inline size_t pointer_diff (const void * base, const void * cursor)
248+ SNMALLOC_FAST_PATH_INLINE size_t
249+ pointer_diff (const void * base, const void * cursor)
246250 {
247251 SNMALLOC_ASSERT (cursor >= base);
248252 return static_cast <size_t >(
@@ -254,7 +258,8 @@ namespace snmalloc
254258 typename U = void ,
255259 SNMALLOC_CONCEPT (capptr::IsBound) Tbounds,
256260 SNMALLOC_CONCEPT (capptr::IsBound) Ubounds>
257- inline size_t pointer_diff (CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
261+ SNMALLOC_FAST_PATH_INLINE size_t
262+ pointer_diff (CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
258263 {
259264 return pointer_diff (base.unsafe_ptr (), cursor.unsafe_ptr ());
260265 }
@@ -263,7 +268,8 @@ namespace snmalloc
263268 * Compute the difference in pointers in units of char. This can be used
264269 * across allocations.
265270 */
266- inline ptrdiff_t pointer_diff_signed (void * base, void * cursor)
271+ SNMALLOC_FAST_PATH_INLINE ptrdiff_t
272+ pointer_diff_signed (void * base, void * cursor)
267273 {
268274 return static_cast <ptrdiff_t >(
269275 static_cast <char *>(cursor) - static_cast <char *>(base));
@@ -274,7 +280,7 @@ namespace snmalloc
274280 typename U = void ,
275281 SNMALLOC_CONCEPT (capptr::IsBound) Tbounds,
276282 SNMALLOC_CONCEPT (capptr::IsBound) Ubounds>
277- inline ptrdiff_t
283+ SNMALLOC_FAST_PATH_INLINE ptrdiff_t
278284 pointer_diff_signed (CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
279285 {
280286 return pointer_diff_signed (base.unsafe_ptr (), cursor.unsafe_ptr ());
@@ -285,7 +291,7 @@ namespace snmalloc
285291 * putative alignment.
286292 */
287293 template <size_t alignment>
288- inline size_t address_misalignment (address_t a)
294+ SNMALLOC_FAST_PATH_INLINE size_t address_misalignment (address_t a)
289295 {
290296 return static_cast <size_t >(a - pointer_align_down<alignment>(a));
291297 }
0 commit comments