Go to the source code of this file.
 | 
| #define  | CLIB_UNIX | 
|   | 
| #define  | BITS(x)   (8*sizeof(x)) | 
|   | 
| #define  | ARRAY_LEN(x)   (sizeof (x)/sizeof (x[0])) | 
|   | 
| #define  | STRUCT_OFFSET_OF(t,  f)   ((uword) & _STRUCT_FIELD (t, f)) | 
|   | 
| #define  | STRUCT_BIT_OFFSET_OF(t,  f)   (BITS(u8) * (uword) & _STRUCT_FIELD (t, f)) | 
|   | 
| #define  | STRUCT_SIZE_OF(t,  f)   (sizeof (_STRUCT_FIELD (t, f))) | 
|   | 
| #define  | STRUCT_BITS_OF(t,  f)   (BITS (_STRUCT_FIELD (t, f))) | 
|   | 
| #define  | STRUCT_ARRAY_LEN(t,  f)   ARRAY_LEN (_STRUCT_FIELD (t, f)) | 
|   | 
| #define  | STRUCT_MARK(mark)   u8 mark[0] | 
|   | 
| #define  | STRUCT_MARK_PTR(v,  f)   &(v)->f | 
|   | 
| #define  | STRUCT_STRIDE_OF(t,  f) | 
|   | 
| #define  | STRUCT_OFFSET_OF_VAR(v,  f)   ((uword) (&(v)->f) - (uword) (v)) | 
|   | 
| #define  | CLIB_PACKED(x)   x __attribute__ ((packed)) | 
|   | 
| #define  | CLIB_UNUSED(x)   x __attribute__ ((unused)) | 
|   | 
| #define  | CLIB_ALIGN_MARK(name,  alignment)   u8 name[0] __attribute__((aligned(alignment))) | 
|   | 
| #define  | CLIB_STRING_MACRO(x)   #x | 
|   | 
| #define  | never_inline   __attribute__ ((__noinline__)) | 
|   | 
| #define  | always_inline   static inline | 
|   | 
| #define  | static_always_inline   static inline | 
|   | 
| #define  | u8   pad_from[(to) - (from)] u8 pad_##from[(to) - (from)] | 
|   | Padding.  More...
  | 
|   | 
| #define  | PREDICT_FALSE(x)   __builtin_expect((x),0) | 
|   | 
| #define  | PREDICT_TRUE(x)   __builtin_expect((x),1) | 
|   | 
| #define  | CLIB_COMPILER_BARRIER()   asm volatile ("":::"memory") | 
|   | 
| #define  | CLIB_MEMORY_BARRIER()   __sync_synchronize () | 
|   | 
| #define  | CLIB_MEMORY_STORE_BARRIER()   __builtin_ia32_sfence () | 
|   | 
| #define  | INIT_FUNCTION(decl) | 
|   | 
| #define  | EXIT_FUNCTION(decl) | 
|   | 
| #define  | count_leading_zeros(x)   __builtin_clzl (x) | 
|   | 
| #define  | count_trailing_zeros(x)   __builtin_ctzl (x) | 
|   | 
| #define  | clib_max(x,  y) | 
|   | 
| #define  | clib_min(x,  y) | 
|   | 
| #define  | clib_abs(x) | 
|   | 
◆ always_inline
      
        
          | #define always_inline   static inline | 
        
      
 
 
◆ ARRAY_LEN
      
        
          | #define ARRAY_LEN | 
          ( | 
            | 
          x | ) | 
             (sizeof (x)/sizeof (x[0])) | 
        
      
 
 
◆ BITS
      
        
          | #define BITS | 
          ( | 
            | 
          x | ) | 
             (8*sizeof(x)) | 
        
      
 
 
◆ clib_abs
Value:({                                              \
  __typeof__ (x) _x = (x);                      \
  _x < 0 ? -_x : _x;                            \
})
 
Definition at line 326 of file clib.h.
 
 
◆ CLIB_ALIGN_MARK
      
        
          | #define CLIB_ALIGN_MARK | 
          ( | 
            | 
          name,  | 
        
        
           | 
           | 
            | 
          alignment  | 
        
        
           | 
          ) | 
           |    u8 name[0] __attribute__((aligned(alignment))) | 
        
      
 
 
◆ CLIB_COMPILER_BARRIER
      
        
          | #define CLIB_COMPILER_BARRIER | 
          ( | 
           | ) | 
             asm volatile ("":::"memory") | 
        
      
 
 
◆ clib_max
      
        
          | #define clib_max | 
          ( | 
            | 
          x,  | 
        
        
           | 
           | 
            | 
          y  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Value:({                                              \
  __typeof__ (x) _x = (x);                      \
  __typeof__ (y) _y = (y);                      \
  _x > _y ? _x : _y;                            \
})
 
Definition at line 312 of file clib.h.
 
 
◆ CLIB_MEMORY_BARRIER
      
        
          | #define CLIB_MEMORY_BARRIER | 
          ( | 
           | ) | 
             __sync_synchronize () | 
        
      
 
 
◆ CLIB_MEMORY_STORE_BARRIER
      
        
          | #define CLIB_MEMORY_STORE_BARRIER | 
          ( | 
           | ) | 
             __builtin_ia32_sfence () | 
        
      
 
 
◆ clib_min
      
        
          | #define clib_min | 
          ( | 
            | 
          x,  | 
        
        
           | 
           | 
            | 
          y  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Value:({                                              \
  __typeof__ (x) _x = (x);                      \
  __typeof__ (y) _y = (y);                      \
  _x < _y ? _x : _y;                            \
})
 
Definition at line 319 of file clib.h.
 
 
◆ CLIB_PACKED
      
        
          | #define CLIB_PACKED | 
          ( | 
            | 
          x | ) | 
             x __attribute__ ((packed)) | 
        
      
 
 
◆ CLIB_STRING_MACRO
      
        
          | #define CLIB_STRING_MACRO | 
          ( | 
            | 
          x | ) | 
             #x | 
        
      
 
 
◆ CLIB_UNIX
◆ CLIB_UNUSED
      
        
          | #define CLIB_UNUSED | 
          ( | 
            | 
          x  | ) | 
             x __attribute__ ((unused)) | 
        
      
 
 
◆ count_leading_zeros
      
        
          | #define count_leading_zeros | 
          ( | 
            | 
          x | ) | 
             __builtin_clzl (x) | 
        
      
 
 
◆ count_trailing_zeros
      
        
          | #define count_trailing_zeros | 
          ( | 
            | 
          x | ) | 
             __builtin_ctzl (x) | 
        
      
 
 
◆ EXIT_FUNCTION
      
        
          | #define EXIT_FUNCTION | 
          ( | 
            | 
          decl | ) | 
           | 
        
      
 
Value:decl __attribute ((destructor));                \
  decl
 
Definition at line 144 of file clib.h.
 
 
◆ INIT_FUNCTION
      
        
          | #define INIT_FUNCTION | 
          ( | 
            | 
          decl | ) | 
           | 
        
      
 
Value:decl __attribute ((constructor));               \
  decl
 
Definition at line 139 of file clib.h.
 
 
◆ never_inline
      
        
          | #define never_inline   __attribute__ ((__noinline__)) | 
        
      
 
 
◆ PREDICT_FALSE
      
        
          | #define PREDICT_FALSE | 
          ( | 
            | 
          x | ) | 
             __builtin_expect((x),0) | 
        
      
 
 
◆ PREDICT_TRUE
      
        
          | #define PREDICT_TRUE | 
          ( | 
            | 
          x | ) | 
             __builtin_expect((x),1) | 
        
      
 
 
◆ static_always_inline
      
        
          | #define static_always_inline   static inline | 
        
      
 
 
◆ STRUCT_ARRAY_LEN
      
        
          | #define STRUCT_ARRAY_LEN | 
          ( | 
            | 
          t,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    ARRAY_LEN (_STRUCT_FIELD (t, f)) | 
        
      
 
 
◆ STRUCT_BIT_OFFSET_OF
      
        
          | #define STRUCT_BIT_OFFSET_OF | 
          ( | 
            | 
          t,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    (BITS(u8) * (uword) & _STRUCT_FIELD (t, f)) | 
        
      
 
 
◆ STRUCT_BITS_OF
      
        
          | #define STRUCT_BITS_OF | 
          ( | 
            | 
          t,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    (BITS (_STRUCT_FIELD (t, f))) | 
        
      
 
 
◆ STRUCT_MARK
      
        
          | #define STRUCT_MARK | 
          ( | 
            | 
          mark | ) | 
             u8 mark[0] | 
        
      
 
 
◆ STRUCT_MARK_PTR
      
        
          | #define STRUCT_MARK_PTR | 
          ( | 
            | 
          v,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    &(v)->f | 
        
      
 
 
◆ STRUCT_OFFSET_OF
      
        
          | #define STRUCT_OFFSET_OF | 
          ( | 
            | 
          t,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    ((uword) & _STRUCT_FIELD (t, f)) | 
        
      
 
 
◆ STRUCT_OFFSET_OF_VAR
      
        
          | #define STRUCT_OFFSET_OF_VAR | 
          ( | 
            | 
          v,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    ((uword) (&(v)->f) - (uword) (v)) | 
        
      
 
 
◆ STRUCT_SIZE_OF
      
        
          | #define STRUCT_SIZE_OF | 
          ( | 
            | 
          t,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |    (sizeof (_STRUCT_FIELD (t, f))) | 
        
      
 
 
◆ STRUCT_STRIDE_OF
      
        
          | #define STRUCT_STRIDE_OF | 
          ( | 
            | 
          t,  | 
        
        
           | 
           | 
            | 
          f  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Value:(  ((
uword) & (((t *) 0)[1].f))         \
   - ((
uword) & (((t *) 0)[0].f)))
 
 
Definition at line 78 of file clib.h.
 
 
◆ u8
      
        
          | #define u8   pad_from[(to) - (from)] u8 pad_##from[(to) - (from)] | 
        
      
 
Padding. 
Definition at line 115 of file clib.h.
 
 
◆ clib_backtrace()
◆ extract_bits()
  
  
      
        
          | static uword extract_bits  | 
          ( | 
          uword  | 
          x,  | 
         
        
           | 
           | 
          int  | 
          start,  | 
         
        
           | 
           | 
          int  | 
          count  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
 
◆ first_set()
◆ flt_round_down()
  
  
      
        
          | static f64 flt_round_down  | 
          ( | 
          f64  | 
          x | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
 
◆ flt_round_nearest()
  
  
      
        
          | static word flt_round_nearest  | 
          ( | 
          f64  | 
          x | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
 
◆ flt_round_to_multiple()
  
  
      
        
          | static f64 flt_round_to_multiple  | 
          ( | 
          f64  | 
          x,  | 
         
        
           | 
           | 
          f64  | 
          f  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
 
◆ is_pow2()
◆ log2_first_set()
◆ max_log2()
◆ max_pow2()
◆ min_log2()
◆ min_log2_u64()
  
  
      
        
          | static u64 min_log2_u64  | 
          ( | 
          u64  | 
          x | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
 
◆ pow2_mask()
◆ round_pow2()
◆ round_pow2_u64()
  
  
      
        
          | static u64 round_pow2_u64  | 
          ( | 
          u64  | 
          x,  | 
         
        
           | 
           | 
          u64  | 
          pow2  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   |