2022-09-19 12:39:02 +02:00
|
|
|
/* Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC)
|
|
|
|
* SPDX-License-Identifier: MIT */
|
|
|
|
|
2021-11-18 11:55:28 +01:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
2022-08-22 16:02:07 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2021-11-18 11:55:28 +01:00
|
|
|
/* Debug macros */
|
|
|
|
|
|
|
|
#ifdef ENABLE_DEBUG
|
|
|
|
# define dbg(...) fprintf(stderr, __VA_ARGS__);
|
|
|
|
#else
|
|
|
|
# define dbg(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define err(...) fprintf(stderr, __VA_ARGS__);
|
2021-12-07 17:26:08 +01:00
|
|
|
#define die(...) do { err("fatal: " __VA_ARGS__); abort(); } while (0)
|
2021-11-18 11:55:28 +01:00
|
|
|
|
|
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
|
#define UNUSED(x) (void)(x)
|
|
|
|
|
2021-12-09 16:56:24 +01:00
|
|
|
/* Poison assert */
|
|
|
|
#pragma GCC poison assert
|
|
|
|
|
2021-11-18 11:55:28 +01:00
|
|
|
#endif /* COMMON_H */
|