OpenNSL API Guide and Reference Manual
compiler.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * (C) Copyright Broadcom Corporation 2013-2016
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  ********************************************************************
18  * File: compiler.h
19  * Details: Compiler specific defines and options
20  *******************************************************************/
21 
22 #ifndef _SAL_COMPILER_H
23 #define _SAL_COMPILER_H
24 
25 /*
26  * Define attributes according to compiler.
27  * Currently we have used GNU C, Diab Data, and Borland compilers.
28  */
29 
30 #define COMPILER_HAS_CONST
31 #define COMPILER_HAS_STATIC
32 
33 #ifndef __KERNEL__
34 #define COMPILER_HAS_DOUBLE
35 #endif
36 
37 /*
38  * Return a string containing the current FILE:LINE location in the code.
39  *
40  */
41 #ifndef FILE_LINE_STRING
42 
43 #define __STRINGIFY(x) #x
44 #define _STRINGIFY(x) __STRINGIFY(x)
45 
46 #define FILE_LINE_STRING() (__FILE__ ":" _STRINGIFY(__LINE__))
47 
48 #endif /* FILE_LINE_STRING */
49 
50 
51 #if defined(__GNUC__) && !defined(__PEDANTIC__)
52 
53 #define COMPILER_HAS_LONGLONG
54 #if defined(VXWORKS) && ((CPU == PPC860) || (CPU == PPC603) || (CPU == PPC32))
55 /*
56  * WRS T2 (Cygnus 2.7.2) PPC compiler can't handle 64-bit properly.
57  * It generates bad code for shift by 32. It also generates false
58  * "variable might be used initialized" warnings for COMPILER_ZERO.
59  */
60 #if (VX_VERSION == 55) || (VX_VERSION >= 62)
61 # define COMPILER_HAS_LONGLONG_SHIFT
62 #else
63 # undef COMPILER_HAS_LONGLONG_SHIFT
64 #endif
65 #else
66 # define COMPILER_HAS_LONGLONG_SHIFT
67 #endif
68 #define COMPILER_HAS_LONGLONG_ADDSUB
69 #define COMPILER_HAS_LONGLONG_MUL
70 #define COMPILER_HAS_LONGLONG_DIV
71 #define COMPILER_HAS_LONGLONG_ANDOR
72 #define COMPILER_HAS_LONGLONG_COMPARE
73 
74 #if ((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= 30201
75 /* gcc 3.2.1 is the earliest version known to support the format attribute
76  when applied to function pointers. gcc 3.0.0 is known to *not* support
77  this. */
78 #define COMPILER_HAS_FUNCTION_POINTER_FORMAT_ATTRIBUTE
79 #endif
80 
81 #ifndef __STRICT_ANSI__
82 #define COMPILER_HAS_INLINE
83 #endif
84 
85 #define COMPILER_ATTRIBUTE(_a) __attribute__ (_a)
86 #define COMPILER_REFERENCE(_a) ((void)(_a))
87 #define FUNCTION_NAME() (__FUNCTION__)
88 
89 #elif (defined(__DCC__) && (__DCC__ == 1)) && !defined(__PEDANTIC__)
90 
91 #define COMPILER_HAS_LONGLONG
92 #define COMPILER_HAS_LONGLONG_SHIFT
93 #define COMPILER_HAS_LONGLONG_ADDSUB
94 #define COMPILER_HAS_LONGLONG_MUL
95 #define COMPILER_HAS_LONGLONG_DIV
96 #define COMPILER_HAS_LONGLONG_ANDOR
97 #define COMPILER_HAS_LONGLONG_COMPARE
98 
99 #define COMPILER_ATTRIBUTE(_a)
100 #define COMPILER_REFERENCE(_a) ((void)(_a))
101 
102 #if (defined(DIAB_VER)) && (DIAB_VER == 4)
103 /* Older versions of DCC do not support __FUNCTION__ */
104 #define FUNCTION_NAME() FILE_LINE_STRING()
105 #else
106 #define FUNCTION_NAME() (__FUNCTION__)
107 #endif
108 
109 #else /* !defined(__GNUC__) */
110 
111 #define COMPILER_ATTRIBUTE(_a)
112 #define COMPILER_REFERENCE(_a) ((void)(_a))
113 
114 #ifndef FUNCTION_NAME
115 /*
116  * No portable ANSI method to accomplish this.
117  * Just return the location in the code instead.
118  */
119 #define FUNCTION_NAME() FILE_LINE_STRING()
120 
121 #endif /* FUNCTION_NAME */
122 
123 #endif /* !defined(__GNUC__) */
124 
125 /* GreenHills compiler */
126 #ifdef GHS
127 #define COMPILER_HAS_LONGLONG
128 #define COMPILER_HAS_LONGLONG_SHIFT
129 #define COMPILER_HAS_LONGLONG_ADDSUB
130 #define COMPILER_HAS_LONGLONG_MUL
131 #define COMPILER_HAS_LONGLONG_DIV
132 #define COMPILER_HAS_LONGLONG_ANDOR
133 #define COMPILER_HAS_LONGLONG_COMPARE
134 
135 /* GreenHills compiler has __FUNCTION__ built-in macro not __func__ */
136 #define __func__ __FUNCTION__
137 #endif
138 
139 /*
140  * __attribute__ for function pointers
141  */
142 #ifdef COMPILER_HAS_FUNCTION_POINTER_FORMAT_ATTRIBUTE
143 #define COMPILER_ATTRIBUTE_FUNCTION_POINTER(_a) COMPILER_ATTRIBUTE(_a)
144 #else
145 #define COMPILER_ATTRIBUTE_FUNCTION_POINTER(_a)
146 #endif
147 
148 
149 #ifdef __PEDANTIC__
150 #define COMPILER_STRING_CONST_LIMIT 509
151 #endif
152 
153 /*
154  * Compiler overrides that can be configured in Make.local
155  */
156 #ifdef COMPILER_OVERRIDE_NO_LONGLONG
157 #undef COMPILER_HAS_LONGLONG
158 #undef COMPILER_HAS_LONGLONG_SHIFT
159 #undef COMPILER_HAS_LONGLONG_ADDSUB
160 #undef COMPILER_HAS_LONGLONG_MUL
161 #undef COMPILER_HAS_LONGLONG_DIV
162 #undef COMPILER_HAS_LONGLONG_ANDOR
163 #undef COMPILER_HAS_LONGLONG_COMPARE
164 #endif
165 
166 #ifdef COMPILER_OVERRIDE_NO_DOUBLE
167 #undef COMPILER_HAS_DOUBLE
168 #endif
169 
170 #ifdef COMPILER_OVERRIDE_NO_INLINE
171 #undef COMPILER_HAS_INLINE
172 #endif
173 
174 #ifdef COMPILER_OVERRIDE_NO_CONST
175 #undef COMPILER_HAS_CONST
176 #endif
177 
178 #ifdef COMPILER_OVERRIDE_NO_STATIC
179 #undef COMPILER_HAS_STATIC
180 #endif
181 
182 /*
183  * 64-bit word order
184  */
185 
186 #ifdef __BORLAND__
187 /* The Borland cpp does not expand correctly in the macros below...sigh */
188 static int u64_MSW = 1;
189 static int u64_LSW = 0;
190 #else
191 # ifdef BE_HOST
192 # define u64_MSW 0
193 # define u64_LSW 1
194 # else /* LE_HOST */
195 # define u64_MSW 1
196 # define u64_LSW 0
197 # endif /* LE_HOST */
198 #endif /* __BORLAND__ */
199 
200 /*
201  * 64-bit type
202  */
203 
204 #ifdef LONGS_ARE_64BITS
205 
206 #define COMPILER_64BIT
207 #define COMPILER_UINT64 unsigned long
208 #define COMPILER_INT64 long
209 #define u64_H(v) (((uint32 *) &(v))[u64_MSW])
210 #define u64_L(v) (((uint32 *) &(v))[u64_LSW])
211 #define COMPILER_64_INIT(_hi, _lo) ( (((long) (_hi)) << 32) | (_lo))
212 
213 #else /* !LONGS_ARE_64BITS */
214 
215 #ifdef COMPILER_HAS_LONGLONG
216 
217 #define COMPILER_64BIT
218 #define COMPILER_UINT64 unsigned long long
219 #define COMPILER_INT64 long long
220 #define u64_H(v) (((uint32 *) &(v))[u64_MSW])
221 #define u64_L(v) (((uint32 *) &(v))[u64_LSW])
222 #define COMPILER_64_INIT(_hi, _lo) ( (((long long) (_hi)) << 32) | (_lo))
223 
224 #else /* !COMPILER_HAS_LONGLONG */
225 typedef struct sal_uint64_s { unsigned int u64_w[2]; } sal_uint64_t;
226 /* __doxy_func_body_end__ */
227 typedef struct sal_int64_s { int u64_w[2]; } sal_int64_t;
228 /* __doxy_func_body_end__ */
229 
230 #define COMPILER_UINT64 sal_uint64_t
231 #define COMPILER_INT64 sal_int64_t
232 #define u64_H(v) ((v).u64_w[u64_MSW])
233 #define u64_L(v) ((v).u64_w[u64_LSW])
234 
235 #ifdef BE_HOST
236 #define COMPILER_64_INIT(_hi, _lo) { { _hi, _lo } }
237 /* __doxy_func_body_end__ */
238 #else
239 #define COMPILER_64_INIT(_hi, _lo) { { _lo, _hi } }
240 /* __doxy_func_body_end__ */
241 #endif
242 
243 #endif /* !COMPILER_HAS_LONGLONG */
244 #endif /* LONGS_ARE_64BITS */
245 
246 /*
247  * 32-/64-bit type conversions
248  */
249 
250 #ifdef COMPILER_HAS_LONGLONG_SHIFT
251 
252 #define COMPILER_64_TO_32_LO(dst, src) ((dst) = (uint32) (src))
253 #define COMPILER_64_TO_32_HI(dst, src) ((dst) = (uint32) ((src) >> 32))
254 #define COMPILER_64_HI(src) ((uint32) ((src) >> 32))
255 #define COMPILER_64_LO(src) ((uint32) (src))
256 #define COMPILER_64_ZERO(dst) ((dst) = 0)
257 #define COMPILER_64_IS_ZERO(src) ((src) == 0)
258 
259 
260 #define COMPILER_64_SET(dst, src_hi, src_lo) \
261  ((dst) = (((uint64) ((uint32)(src_hi))) << 32) | ((uint64) ((uint32)(src_lo))))
262 
263 #else /* !COMPILER_HAS_LONGLONG_SHIFT */
264 
265 #define COMPILER_64_TO_32_LO(dst, src) ((dst) = u64_L(src))
266 #define COMPILER_64_TO_32_HI(dst, src) ((dst) = u64_H(src))
267 #define COMPILER_64_HI(src) u64_H(src)
268 #define COMPILER_64_LO(src) u64_L(src)
269 #define COMPILER_64_ZERO(dst) (u64_H(dst) = u64_L(dst) = 0)
270 #define COMPILER_64_IS_ZERO(src) (u64_H(src) == 0 && u64_L(src) == 0)
271 
272 #define COMPILER_64_SET(dst, src_hi, src_lo) \
273  do { \
274  u64_H(dst) = (src_hi); \
275  u64_L(dst) = (src_lo); \
276  } while (0)
277 /* __doxy_func_body_end__ */
278 
279 #endif /* !COMPILER_HAS_LONGLONG_SHIFT */
280 
281 /*
282  * 64-bit addition and subtraction
283  */
284 
285 #ifdef COMPILER_HAS_LONGLONG_ADDSUB
286 
287 #define COMPILER_64_ADD_64(dst, src) ((dst) += (src))
288 #define COMPILER_64_ADD_32(dst, src) ((dst) += (src))
289 #define COMPILER_64_SUB_64(dst, src) ((dst) -= (src))
290 #define COMPILER_64_SUB_32(dst, src) ((dst) -= (src))
291 
292 #else /* !COMPILER_HAS_LONGLONG_ADDSUB */
293 
294 #define COMPILER_64_ADD_64(dst, src) \
295  do { \
296  uint32 __t = u64_L(dst); \
297  u64_L(dst) += u64_L(src); \
298  if (u64_L(dst) < __t) { \
299  u64_H(dst) += u64_H(src) + 1; \
300  } else { \
301  u64_H(dst) += u64_H(src); \
302  } \
303  } while (0)
304 /* __doxy_func_body_end__ */
305 #define COMPILER_64_ADD_32(dst, src) \
306  do { \
307  uint32 __t = u64_L(dst); \
308  u64_L(dst) += (src); \
309  if (u64_L(dst) < __t) { \
310  u64_H(dst)++; \
311  } \
312  } while (0)
313 /* __doxy_func_body_end__ */
314 #define COMPILER_64_SUB_64(dst, src) \
315  do { \
316  uint32 __t = u64_L(dst); \
317  u64_L(dst) -= u64_L(src); \
318  if (u64_L(dst) > __t) { \
319  u64_H(dst) -= u64_H(src) + 1; \
320  } else { \
321  u64_H(dst) -= u64_H(src); \
322  } \
323  } while (0)
324 /* __doxy_func_body_end__ */
325 #define COMPILER_64_SUB_32(dst, src) \
326  do { \
327  uint32 __t = u64_L(dst); \
328  u64_L(dst) -= (src); \
329  if (u64_L(dst) > __t) { \
330  u64_H(dst)--; \
331  } \
332  } while (0)
333 /* __doxy_func_body_end__ */
334 
335 #endif /* !COMPILER_HAS_LONGLONG_ADDSUB */
336 
337 /*
338  * 64-bit multiplication
339  */
340 
341 #ifdef COMPILER_HAS_LONGLONG_MUL
342 
343 #define COMPILER_64_UMUL_32(dst, src) ((dst) *= (src))
344 
345 #else /* !COMPILER_HAS_LONGLONG_MUL */
346 
347 /* Multiply of unsigned 64-bit and unsigned 32-bit integers, no overflow handling */
348 #define COMPILER_64_UMUL_32(dst, src) \
349  do { \
350  uint32 __d[4]; \
351  uint32 __s[2]; \
352  uint32 __r[4]; \
353  uint32 __t[2]; \
354  __d[0] = u64_L(dst) & 0xffff; \
355  __d[1] = u64_L(dst) >> 16; \
356  __d[2] = u64_H(dst) & 0xffff; \
357  __d[3] = u64_H(dst) >> 16; \
358  __s[0] = (src) & 0xffff; \
359  __s[1] = (src) >> 16; \
360  __r[0] = __d[0] * __s[0]; \
361  __r[1] = __d[1] * __s[0] + __d[0] * __s[1]; \
362  __r[2] = __d[2] * __s[0] + __d[1] * __s[1]; \
363  __r[3] = __d[3] * __s[0] + __d[2] * __s[1]; \
364  __t[0] = __r[1] << 16; \
365  __t[1] = __t[0] + __r[0]; \
366  COMPILER_64_SET((dst), (__r[3] << 16) + __r[2] + (__r[1] >> 16) + (__t[1] < __t[0] ? 1 : 0), \
367  __t[1] \
368  ); \
369  } while (0);
370 /* __doxy_func_body_end__ */
371 
372 #endif /* !COMPILER_HAS_LONGLONG_MUL */
373 
374 /*
375  * 64-bit logical operations
376  */
377 
378 #ifdef COMPILER_HAS_LONGLONG_ANDOR
379 
380 #define COMPILER_64_AND(dst, src) ((dst) &= (src))
381 #define COMPILER_64_OR(dst, src) ((dst) |= (src))
382 #define COMPILER_64_XOR(dst, src) ((dst) ^= (src))
383 #define COMPILER_64_NOT(dst) ((dst) = ~(dst))
384 
385 #else /* !COMPILER_HAS_LONGLONG_ANDOR */
386 
387 #define COMPILER_64_AND(dst, src) \
388  do { \
389  u64_H((dst)) &= u64_H((src)); \
390  u64_L((dst)) &= u64_L((src)); \
391  } while (0)
392 /* __doxy_func_body_end__ */
393 #define COMPILER_64_OR(dst, src) \
394  do { \
395  u64_H((dst)) |= u64_H((src)); \
396  u64_L((dst)) |= u64_L((src)); \
397  } while (0)
398 /* __doxy_func_body_end__ */
399 #define COMPILER_64_XOR(dst, src) \
400  do { \
401  u64_H((dst)) ^= u64_H((src)); \
402  u64_L((dst)) ^= u64_L((src)); \
403  } while (0)
404 /* __doxy_func_body_end__ */
405 #define COMPILER_64_NOT(dst) \
406  do { \
407  u64_H((dst)) = ~u64_H((dst)); \
408  u64_L((dst)) = ~u64_L((dst)); \
409  } while (0)
410 /* __doxy_func_body_end__ */
411 
412 #endif /* !COMPILER_HAS_LONGLONG_ANDOR */
413 
414 #define COMPILER_64_ALLONES(dst) \
415  COMPILER_64_ZERO((dst));\
416  COMPILER_64_NOT((dst))
417 
418 /*
419  * 64-bit shift
420  */
421 
422 #ifdef COMPILER_HAS_LONGLONG_SHIFT
423 
424 #define COMPILER_64_SHL(dst, bits) ((dst) <<= (bits))
425 #define COMPILER_64_SHR(dst, bits) ((dst) >>= (bits))
426 
427 #define COMPILER_64_BITTEST(val, n) \
428  ((((uint64)val) & (((uint64) 1)<<(n))) != ((uint64) 0))
429 
430 #else /* !COMPILER_HAS_LONGLONG_SHIFT */
431 
432 #define COMPILER_64_SHL(dst, bits) \
433  do { \
434  int __b = (bits); \
435  if (__b >= 32) { \
436  u64_H(dst) = u64_L(dst); \
437  u64_L(dst) = 0; \
438  __b -= 32; \
439  } \
440  u64_H(dst) = (u64_H(dst) << __b) | \
441  (__b ? u64_L(dst) >> (32 - __b) : 0); \
442  u64_L(dst) <<= __b; \
443  } while (0)
444 /* __doxy_func_body_end__ */
445 
446 #define COMPILER_64_SHR(dst, bits) \
447  do { \
448  int __b = (bits); \
449  if (__b >= 32) { \
450  u64_L(dst) = u64_H(dst); \
451  u64_H(dst) = 0; \
452  __b -= 32; \
453  } \
454  u64_L(dst) = (u64_L(dst) >> __b) | \
455  (__b ? u64_H(dst) << (32 - __b) : 0); \
456  u64_H(dst) >>= __b; \
457  } while (0)
458 /* __doxy_func_body_end__ */
459 
460 #define COMPILER_64_BITTEST(val, n) \
461  ( (((n) < 32) && (u64_L(val) & (1 << (n)))) || \
462  (((n) >= 32) && (u64_H(val) & (1 << ((n) - 32)))) )
463 
464 #endif /* !COMPILER_HAS_LONGLONG_SHIFT */
465 
466 /*
467  * 64-bit compare operations
468  */
469 
470 #ifdef COMPILER_HAS_LONGLONG_COMPARE
471 
472 #define COMPILER_64_EQ(src1, src2) ((src1) == (src2))
473 #define COMPILER_64_NE(src1, src2) ((src1) != (src2))
474 #define COMPILER_64_LT(src1, src2) ((src1) < (src2))
475 #define COMPILER_64_LE(src1, src2) ((src1) <= (src2))
476 #define COMPILER_64_GT(src1, src2) ((src1) > (src2))
477 #define COMPILER_64_GE(src1, src2) ((src1) >= (src2))
478 
479 #else /* !COMPILER_HAS_LONGLONG_COMPARE */
480 
481 #define COMPILER_64_EQ(src1, src2) (u64_H(src1) == u64_H(src2) && \
482  u64_L(src1) == u64_L(src2))
483 #define COMPILER_64_NE(src1, src2) (u64_H(src1) != u64_H(src2) || \
484  u64_L(src1) != u64_L(src2))
485 #define COMPILER_64_LT(src1, src2) (u64_H(src1) < u64_H(src2) || \
486  ((u64_H(src1) == u64_H(src2) && \
487  u64_L(src1) < u64_L(src2))))
488 #define COMPILER_64_LE(src1, src2) (u64_H(src1) < u64_H(src2) || \
489  ((u64_H(src1) == u64_H(src2) && \
490  u64_L(src1) <= u64_L(src2))))
491 #define COMPILER_64_GT(src1, src2) (u64_H(src1) > u64_H(src2) || \
492  ((u64_H(src1) == u64_H(src2) && \
493  u64_L(src1) > u64_L(src2))))
494 #define COMPILER_64_GE(src1, src2) (u64_H(src1) > u64_H(src2) || \
495  ((u64_H(src1) == u64_H(src2) && \
496  u64_L(src1) >= u64_L(src2))))
497 
498 #endif /* !COMPILER_HAS_LONGLONG_COMPARE */
499 
500 /* Set up a mask of width bits offset lft_shft. No error checking */
501 #define COMPILER_64_MASK_CREATE(dst, width, lft_shift) \
502  do { \
503  COMPILER_64_ALLONES(dst); \
504  COMPILER_64_SHR((dst), (64 - (width))); \
505  COMPILER_64_SHL((dst), (lft_shift)); \
506  } while (0)
507 /* __doxy_func_body_end__ */
508 
509 #define COMPILER_64_DELTA(src, last, new)\
510  do { \
511  COMPILER_64_ZERO(src);\
512  COMPILER_64_ADD_64(src, new);\
513  COMPILER_64_SUB_64(src, last);\
514  } while(0)
515 /* __doxy_func_body_end__ */
516 
517 #define COMPILER_64_BITSET(dst, n) \
518  do { \
519  uint64 temp64; \
520  COMPILER_64_SET(temp64, 0, 1); \
521  COMPILER_64_SHL(temp64, n); \
522  COMPILER_64_OR(dst, temp64); \
523  } while(0)
524 /* __doxy_func_body_end__ */
525 
526 #define COMPILER_64_BITCLR(dst, n) \
527  do { \
528  uint64 temp64; \
529  COMPILER_64_SET(temp64, 0, 1); \
530  COMPILER_64_SHL(temp64, n); \
531  COMPILER_64_NOT(temp64); \
532  COMPILER_64_AND(dst, temp64); \
533  } while(0)
534 /* __doxy_func_body_end__ */
535 
536 
537  /*
538  * 64-bit division
539  */
540 
541 #if defined COMPILER_HAS_LONGLONG_DIV && ! defined (__KERNEL__)
542 
543 #define COMPILER_64_UDIV_64(dst, src) ((dst) /= (src))
544 
545 #else /* !(defined COMPILER_HAS_LONGLONG_DIV && ! defined (__KERNEL__)) */
546 
547 /* Divide of unsigned 64-bit and unsigned 64-bit integers, no overflow handling */
548 #define COMPILER_64_UDIV_64(dst, src) \
549  do { \
550  uint32 q_hi = 0, q_lo = 0; \
551  while( COMPILER_64_GE(dst, src) ) \
552  { \
553  COMPILER_64_SUB_64(dst, src); \
554  if (++q_lo == 0) ++q_hi; \
555  } \
556  COMPILER_64_SET(dst, q_hi, q_lo); \
557  } while (0)
558 /* __doxy_func_body_end__ */
559 
560 #endif /* defined COMPILER_HAS_LONGLONG_DIV && ! defined (__KERNEL__) */
561 /*
562  * Some macros for double support
563  *
564  * You can use the COMPILER_DOUBLE macro
565  * if you would prefer double precision, but it is not necessary.
566  * If you need more control (or you need to print :), then
567  * then you should use the COMPILER_HAS_DOUBLE macro explicitly.
568  *
569  */
570 #ifdef COMPILER_HAS_DOUBLE
571 #define COMPILER_DOUBLE double
572 #define COMPILER_DOUBLE_FORMAT "f"
573 #define COMPILER_64_TO_DOUBLE(f, i64) \
574  ((f) = COMPILER_64_HI(i64) * 4294967296.0 + COMPILER_64_LO(i64))
575 #define COMPILER_32_TO_DOUBLE(f, i32) \
576  ((f) = (double) (i32))
577 #else
578 #define COMPILER_DOUBLE uint32
579 #define COMPILER_DOUBLE_FORMAT "u"
580 #define COMPILER_64_TO_DOUBLE(f, i64) ((f) = COMPILER_64_LO(i64))
581 #define COMPILER_32_TO_DOUBLE(f, i32) ((f) = (i32))
582 #endif
583 
584 /*
585  * Version of inline that is turned off for compilers that do
586  * not support inline.
587  */
588 
589 #ifndef INLINE
590 # ifdef COMPILER_HAS_INLINE
591 # define INLINE inline
592 # else
593 # define INLINE
594 # endif
595 #endif /* !INLINE */
596 
597 /*
598  * Version of const that is turned off for compilers that do
599  * not support const.
600  */
601 
602 #ifndef CONST
603 # ifdef COMPILER_HAS_CONST
604 # define CONST const
605 # else
606 # define CONST
607 # endif
608 #endif /* !CONST */
609 
610 /*
611  * Some compilers/linkers/OSs do not put static symbols in the
612  * symbol table, which can make debugging harder.
613  */
614 
615 #ifndef STATIC
616 # if defined(COMPILER_HAS_STATIC)
617 # define STATIC static
618 # else
619 # define STATIC
620 # endif
621 #endif /* !STATIC */
622 
623 #endif /* !_SAL_COMPILER_H */