OpenNSL API Guide and Reference Manual
Data Structures | Macros | Typedefs
compiler.h File Reference

Go to the source code of this file.

Data Structures

struct  sal_int64_s
 
struct  sal_uint64_s
 

Macros

#define __STRINGIFY(x)   #x
 
#define _STRINGIFY(x)   __STRINGIFY(x)
 
#define COMPILER_32_TO_DOUBLE(f, i32)   ((f) = (double) (i32))
 
#define COMPILER_64_ADD_32(dst, src)
 
#define COMPILER_64_ADD_64(dst, src)
 
#define COMPILER_64_ALLONES(dst)
 
#define COMPILER_64_AND(dst, src)
 
#define COMPILER_64_BITCLR(dst, n)
 
#define COMPILER_64_BITSET(dst, n)
 
#define COMPILER_64_BITTEST(val, n)
 
#define COMPILER_64_DELTA(src, last, new)
 
#define COMPILER_64_EQ(src1, src2)
 
#define COMPILER_64_GE(src1, src2)
 
#define COMPILER_64_GT(src1, src2)
 
#define COMPILER_64_HI(src)   u64_H(src)
 
#define COMPILER_64_INIT(_hi, _lo)   { { _lo, _hi } }
 
#define COMPILER_64_IS_ZERO(src)   (u64_H(src) == 0 && u64_L(src) == 0)
 
#define COMPILER_64_LE(src1, src2)
 
#define COMPILER_64_LO(src)   u64_L(src)
 
#define COMPILER_64_LT(src1, src2)
 
#define COMPILER_64_MASK_CREATE(dst, width, lft_shift)
 
#define COMPILER_64_NE(src1, src2)
 
#define COMPILER_64_NOT(dst)
 
#define COMPILER_64_OR(dst, src)
 
#define COMPILER_64_SET(dst, src_hi, src_lo)
 
#define COMPILER_64_SHL(dst, bits)
 
#define COMPILER_64_SHR(dst, bits)
 
#define COMPILER_64_SUB_32(dst, src)
 
#define COMPILER_64_SUB_64(dst, src)
 
#define COMPILER_64_TO_32_HI(dst, src)   ((dst) = u64_H(src))
 
#define COMPILER_64_TO_32_LO(dst, src)   ((dst) = u64_L(src))
 
#define COMPILER_64_TO_DOUBLE(f, i64)   ((f) = COMPILER_64_HI(i64) * 4294967296.0 + COMPILER_64_LO(i64))
 
#define COMPILER_64_UDIV_64(dst, src)
 
#define COMPILER_64_UMUL_32(dst, src)
 
#define COMPILER_64_XOR(dst, src)
 
#define COMPILER_64_ZERO(dst)   (u64_H(dst) = u64_L(dst) = 0)
 
#define COMPILER_ATTRIBUTE(_a)
 
#define COMPILER_ATTRIBUTE_FUNCTION_POINTER(_a)
 
#define COMPILER_DOUBLE   double
 
#define COMPILER_DOUBLE_FORMAT   "f"
 
#define COMPILER_HAS_CONST
 
#define COMPILER_HAS_DOUBLE
 
#define COMPILER_HAS_STATIC
 
#define COMPILER_INT64   sal_int64_t
 
#define COMPILER_REFERENCE(_a)   ((void)(_a))
 
#define COMPILER_UINT64   sal_uint64_t
 
#define CONST   const
 
#define FILE_LINE_STRING()   (__FILE__ ":" _STRINGIFY(__LINE__))
 
#define FUNCTION_NAME()   FILE_LINE_STRING()
 
#define INLINE
 
#define STATIC   static
 
#define u64_H(v)   ((v).u64_w[u64_MSW])
 
#define u64_L(v)   ((v).u64_w[u64_LSW])
 
#define u64_LSW   0
 
#define u64_MSW   1
 

Typedefs

typedef struct sal_int64_s sal_int64_t
 
typedef struct sal_uint64_s sal_uint64_t
 

Macro Definition Documentation

#define __STRINGIFY (   x)    #x

Definition at line 43 of file compiler.h.

#define _STRINGIFY (   x)    __STRINGIFY(x)

Definition at line 44 of file compiler.h.

#define COMPILER_32_TO_DOUBLE (   f,
  i32 
)    ((f) = (double) (i32))

Definition at line 575 of file compiler.h.

#define COMPILER_64_ADD_32 (   dst,
  src 
)
Value:
do { \
uint32 __t = u64_L(dst); \
u64_L(dst) += (src); \
if (u64_L(dst) < __t) { \
u64_H(dst)++; \
} \
} while (0)

Definition at line 305 of file compiler.h.

#define COMPILER_64_ADD_64 (   dst,
  src 
)
Value:
do { \
uint32 __t = u64_L(dst); \
u64_L(dst) += u64_L(src); \
if (u64_L(dst) < __t) { \
u64_H(dst) += u64_H(src) + 1; \
} else { \
u64_H(dst) += u64_H(src); \
} \
} while (0)

Definition at line 294 of file compiler.h.

#define COMPILER_64_ALLONES (   dst)
Value:
COMPILER_64_NOT((dst))

Definition at line 414 of file compiler.h.

#define COMPILER_64_AND (   dst,
  src 
)
Value:
do { \
u64_H((dst)) &= u64_H((src)); \
u64_L((dst)) &= u64_L((src)); \
} while (0)

Definition at line 387 of file compiler.h.

#define COMPILER_64_BITCLR (   dst,
 
)
Value:
do { \
uint64 temp64; \
COMPILER_64_SET(temp64, 0, 1); \
COMPILER_64_SHL(temp64, n); \
COMPILER_64_NOT(temp64); \
COMPILER_64_AND(dst, temp64); \
} while(0)

Definition at line 526 of file compiler.h.

#define COMPILER_64_BITSET (   dst,
 
)
Value:
do { \
uint64 temp64; \
COMPILER_64_SET(temp64, 0, 1); \
COMPILER_64_SHL(temp64, n); \
COMPILER_64_OR(dst, temp64); \
} while(0)

Definition at line 517 of file compiler.h.

#define COMPILER_64_BITTEST (   val,
 
)
Value:
( (((n) < 32) && (u64_L(val) & (1 << (n)))) || \
(((n) >= 32) && (u64_H(val) & (1 << ((n) - 32)))) )

Definition at line 460 of file compiler.h.

#define COMPILER_64_DELTA (   src,
  last,
  new 
)
Value:
do { \
COMPILER_64_ZERO(src);\
COMPILER_64_ADD_64(src, new);\
COMPILER_64_SUB_64(src, last);\
} while(0)

Definition at line 509 of file compiler.h.

#define COMPILER_64_EQ (   src1,
  src2 
)
Value:
(u64_H(src1) == u64_H(src2) && \
u64_L(src1) == u64_L(src2))

Definition at line 481 of file compiler.h.

#define COMPILER_64_GE (   src1,
  src2 
)
Value:
(u64_H(src1) > u64_H(src2) || \
((u64_H(src1) == u64_H(src2) && \
u64_L(src1) >= u64_L(src2))))

Definition at line 494 of file compiler.h.

#define COMPILER_64_GT (   src1,
  src2 
)
Value:
(u64_H(src1) > u64_H(src2) || \
((u64_H(src1) == u64_H(src2) && \
u64_L(src1) > u64_L(src2))))

Definition at line 491 of file compiler.h.

#define COMPILER_64_HI (   src)    u64_H(src)

Definition at line 267 of file compiler.h.

#define COMPILER_64_INIT (   _hi,
  _lo 
)    { { _lo, _hi } }

Definition at line 239 of file compiler.h.

#define COMPILER_64_IS_ZERO (   src)    (u64_H(src) == 0 && u64_L(src) == 0)

Definition at line 270 of file compiler.h.

#define COMPILER_64_LE (   src1,
  src2 
)
Value:
(u64_H(src1) < u64_H(src2) || \
((u64_H(src1) == u64_H(src2) && \
u64_L(src1) <= u64_L(src2))))

Definition at line 488 of file compiler.h.

#define COMPILER_64_LO (   src)    u64_L(src)

Definition at line 268 of file compiler.h.

#define COMPILER_64_LT (   src1,
  src2 
)
Value:
(u64_H(src1) < u64_H(src2) || \
((u64_H(src1) == u64_H(src2) && \
u64_L(src1) < u64_L(src2))))

Definition at line 485 of file compiler.h.

#define COMPILER_64_MASK_CREATE (   dst,
  width,
  lft_shift 
)
Value:
do { \
COMPILER_64_ALLONES(dst); \
COMPILER_64_SHR((dst), (64 - (width))); \
COMPILER_64_SHL((dst), (lft_shift)); \
} while (0)

Definition at line 501 of file compiler.h.

#define COMPILER_64_NE (   src1,
  src2 
)
Value:
(u64_H(src1) != u64_H(src2) || \
u64_L(src1) != u64_L(src2))

Definition at line 483 of file compiler.h.

#define COMPILER_64_NOT (   dst)
Value:
do { \
u64_H((dst)) = ~u64_H((dst)); \
u64_L((dst)) = ~u64_L((dst)); \
} while (0)

Definition at line 405 of file compiler.h.

#define COMPILER_64_OR (   dst,
  src 
)
Value:
do { \
u64_H((dst)) |= u64_H((src)); \
u64_L((dst)) |= u64_L((src)); \
} while (0)

Definition at line 393 of file compiler.h.

#define COMPILER_64_SET (   dst,
  src_hi,
  src_lo 
)
Value:
do { \
u64_H(dst) = (src_hi); \
u64_L(dst) = (src_lo); \
} while (0)

Definition at line 272 of file compiler.h.

#define COMPILER_64_SHL (   dst,
  bits 
)
Value:
do { \
int __b = (bits); \
if (__b >= 32) { \
u64_H(dst) = u64_L(dst); \
u64_L(dst) = 0; \
__b -= 32; \
} \
u64_H(dst) = (u64_H(dst) << __b) | \
(__b ? u64_L(dst) >> (32 - __b) : 0); \
u64_L(dst) <<= __b; \
} while (0)

Definition at line 432 of file compiler.h.

#define COMPILER_64_SHR (   dst,
  bits 
)
Value:
do { \
int __b = (bits); \
if (__b >= 32) { \
u64_L(dst) = u64_H(dst); \
u64_H(dst) = 0; \
__b -= 32; \
} \
u64_L(dst) = (u64_L(dst) >> __b) | \
(__b ? u64_H(dst) << (32 - __b) : 0); \
u64_H(dst) >>= __b; \
} while (0)

Definition at line 446 of file compiler.h.

#define COMPILER_64_SUB_32 (   dst,
  src 
)
Value:
do { \
uint32 __t = u64_L(dst); \
u64_L(dst) -= (src); \
if (u64_L(dst) > __t) { \
u64_H(dst)--; \
} \
} while (0)

Definition at line 325 of file compiler.h.

#define COMPILER_64_SUB_64 (   dst,
  src 
)
Value:
do { \
uint32 __t = u64_L(dst); \
u64_L(dst) -= u64_L(src); \
if (u64_L(dst) > __t) { \
u64_H(dst) -= u64_H(src) + 1; \
} else { \
u64_H(dst) -= u64_H(src); \
} \
} while (0)

Definition at line 314 of file compiler.h.

#define COMPILER_64_TO_32_HI (   dst,
  src 
)    ((dst) = u64_H(src))

Definition at line 266 of file compiler.h.

#define COMPILER_64_TO_32_LO (   dst,
  src 
)    ((dst) = u64_L(src))

Definition at line 265 of file compiler.h.

#define COMPILER_64_TO_DOUBLE (   f,
  i64 
)    ((f) = COMPILER_64_HI(i64) * 4294967296.0 + COMPILER_64_LO(i64))

Definition at line 573 of file compiler.h.

#define COMPILER_64_UDIV_64 (   dst,
  src 
)
Value:
do { \
uint32 q_hi = 0, q_lo = 0; \
while( COMPILER_64_GE(dst, src) ) \
{ \
COMPILER_64_SUB_64(dst, src); \
if (++q_lo == 0) ++q_hi; \
} \
COMPILER_64_SET(dst, q_hi, q_lo); \
} while (0)

Definition at line 548 of file compiler.h.

#define COMPILER_64_UMUL_32 (   dst,
  src 
)
Value:
do { \
uint32 __d[4]; \
uint32 __s[2]; \
uint32 __r[4]; \
uint32 __t[2]; \
__d[0] = u64_L(dst) & 0xffff; \
__d[1] = u64_L(dst) >> 16; \
__d[2] = u64_H(dst) & 0xffff; \
__d[3] = u64_H(dst) >> 16; \
__s[0] = (src) & 0xffff; \
__s[1] = (src) >> 16; \
__r[0] = __d[0] * __s[0]; \
__r[1] = __d[1] * __s[0] + __d[0] * __s[1]; \
__r[2] = __d[2] * __s[0] + __d[1] * __s[1]; \
__r[3] = __d[3] * __s[0] + __d[2] * __s[1]; \
__t[0] = __r[1] << 16; \
__t[1] = __t[0] + __r[0]; \
COMPILER_64_SET((dst), (__r[3] << 16) + __r[2] + (__r[1] >> 16) + (__t[1] < __t[0] ? 1 : 0), \
__t[1] \
); \
} while (0);

Definition at line 348 of file compiler.h.

#define COMPILER_64_XOR (   dst,
  src 
)
Value:
do { \
u64_H((dst)) ^= u64_H((src)); \
u64_L((dst)) ^= u64_L((src)); \
} while (0)

Definition at line 399 of file compiler.h.

#define COMPILER_64_ZERO (   dst)    (u64_H(dst) = u64_L(dst) = 0)

Definition at line 269 of file compiler.h.

#define COMPILER_ATTRIBUTE (   _a)

Definition at line 111 of file compiler.h.

#define COMPILER_ATTRIBUTE_FUNCTION_POINTER (   _a)

Definition at line 145 of file compiler.h.

#define COMPILER_DOUBLE   double

Definition at line 571 of file compiler.h.

#define COMPILER_DOUBLE_FORMAT   "f"

Definition at line 572 of file compiler.h.

#define COMPILER_HAS_CONST

Definition at line 30 of file compiler.h.

#define COMPILER_HAS_DOUBLE

Definition at line 34 of file compiler.h.

#define COMPILER_HAS_STATIC

Definition at line 31 of file compiler.h.

#define COMPILER_INT64   sal_int64_t

Definition at line 231 of file compiler.h.

#define COMPILER_REFERENCE (   _a)    ((void)(_a))

Definition at line 112 of file compiler.h.

#define COMPILER_UINT64   sal_uint64_t

Definition at line 230 of file compiler.h.

#define CONST   const

Definition at line 604 of file compiler.h.

#define FILE_LINE_STRING ( )    (__FILE__ ":" _STRINGIFY(__LINE__))

Definition at line 46 of file compiler.h.

#define FUNCTION_NAME ( )    FILE_LINE_STRING()

Definition at line 119 of file compiler.h.

#define INLINE

Definition at line 593 of file compiler.h.

#define STATIC   static

Definition at line 617 of file compiler.h.

#define u64_H (   v)    ((v).u64_w[u64_MSW])

Definition at line 232 of file compiler.h.

#define u64_L (   v)    ((v).u64_w[u64_LSW])

Definition at line 233 of file compiler.h.

#define u64_LSW   0

Definition at line 196 of file compiler.h.

#define u64_MSW   1

Definition at line 195 of file compiler.h.

Typedef Documentation

typedef struct sal_int64_s sal_int64_t
typedef struct sal_uint64_s sal_uint64_t