refactor: move macro to utils.h
This commit is contained in:
@@ -9,6 +9,20 @@ extern "C"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#define RX_BURST_MAX 32
|
||||
#define MAX_THREAD_NUM 256 // limit by id_generator
|
||||
|
||||
#define ATOMIC_INC(x) __atomic_fetch_add(x, 1, __ATOMIC_RELAXED)
|
||||
#define ATOMIC_DEC(x) __atomic_fetch_sub(x, 1, __ATOMIC_RELAXED)
|
||||
#define ATOMIC_READ(x) __atomic_load_n(x, __ATOMIC_RELAXED)
|
||||
#define ATOMIC_ZERO(x) __atomic_fetch_and(x, 0, __ATOMIC_RELAXED)
|
||||
#define ATOMIC_ADD(x, y) __atomic_fetch_add(x, y, __ATOMIC_RELAXED)
|
||||
#define ATOMIC_SET(x, y) __atomic_store_n(x, y, __ATOMIC_RELAXED)
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
#define likely(expr) __builtin_expect((expr), 1)
|
||||
#define unlikely(expr) __builtin_expect((expr), 0)
|
||||
|
||||
/*
|
||||
* The maximum number of seconds that can be stored in the time_t value is 2147483647 –- a little over 68 years.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user