XROAD
xroad_aux.h File Reference
#include "xroad_common_fwd.h"
#include <stdint.h>
#include <stdbool.h>
#include <sched.h>
Include dependency graph for xroad_aux.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define xroad_likely(x)   __builtin_expect(!!(x), 1)
 
#define xroad_unlikely(x)   __builtin_expect(!!(x), 0)
 
#define xroad_cpu_pause()   __asm__ volatile("pause\n": : :"memory")
 
#define xroad_fence()   __asm__ volatile("mfence": : :"memory")
 
#define __dtor__(fun)   __attribute__((__cleanup__(fun)))
 
#define __free_dtor__   __dtor__(free_destructor)
 
#define xroad_min(a, b)
 
#define xroad_max(a, b)
 
#define xroad_dbl_cmp(lhs, rhs)
 

Functions

void free_destructor (void *)
 
xroad_str_t xroad_strerror (int32_t err)
 
bool xroad_set_cpu_set (xroad_str_t cpus, cpu_set_t *cpu_set)
 

Detailed Description

Macro Definition Documentation

◆ xroad_dbl_cmp

#define xroad_dbl_cmp (   lhs,
  rhs 
)
Value:
({ \
__typeof__(lhs) lhs1977_ = (lhs); \
__typeof__(rhs) rhs1977_ = (rhs); \
(fabs(lhs1977_ - rhs1977_) < XROAD_EPSILON) ? 0 : \
(lhs1977_ < rhs1977_ ? -1 : 1); \
})

compare two doubles

Returns
0 - equal, <0 - less, >0 - greater

◆ xroad_max

#define xroad_max (   a,
 
)
Value:
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; \
})

find max among a and b

◆ xroad_min

#define xroad_min (   a,
 
)
Value:
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; \
})

find min among a and b

Function Documentation

◆ xroad_set_cpu_set()

bool xroad_set_cpu_set ( xroad_str_t  cpus,
cpu_set_t *  cpu_set 
)

fill cpu_set with CPUs

Parameters
[in]cpus- list of CPUs starting from 0 "0,1,2,3"
[out]cpu_set- cpu set to fill
Returns
true - filled, else cpus has wrong format

◆ xroad_strerror()

xroad_str_t xroad_strerror ( int32_t  err)

convert error code into string representation

Parameters
[in]err- error to convert
Returns
error string representation