#include "xroad_common_fwd.h"
#include <stdint.h>
#include <stdbool.h>
#include <sched.h>
Go to the source code of this file.
|
#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) |
|
◆ 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, |
|
|
|
b |
|
) |
| |
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, |
|
|
|
b |
|
) |
| |
Value:({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; \
})
find min among a and b
◆ 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()
convert error code into string representation
- Parameters
-
[in] | err | - error to convert |
- Returns
- error string representation