oxedyne/fe2o3/fe2o3_text/tests/detect_corpus/c/preprocessor.txt
1003 bytes, 1 run
created by r1870400018:11940, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | #include <stdlib.h> |
| 2 | #include <string.h> |
| 3 | |
| 4 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| 5 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
| 6 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
| 7 | #define CLAMP(x, lo, hi) MIN(MAX(x, lo), hi) |
| 8 | |
| 9 | #ifdef DEBUG |
| 10 | #define LOG(fmt, ...) fprintf(stderr, "[DEBUG] " fmt "\n", ##__VA_ARGS__) |
| 11 | #else |
| 12 | #define LOG(fmt, ...) ((void)0) |
| 13 | #endif |
| 14 | |
| 15 | #if defined(__GNUC__) || defined(__clang__) |
| 16 | #define LIKELY(x) __builtin_expect(!!(x), 1) |
| 17 | #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
| 18 | #define PACKED __attribute__((packed)) |
| 19 | #define ALIGNED(n) __attribute__((aligned(n))) |
| 20 | #else |
| 21 | #define LIKELY(x) (x) |
| 22 | #define UNLIKELY(x) (x) |
| 23 | #define PACKED |
| 24 | #define ALIGNED(n) |
| 25 | #endif |
| 26 | |
| 27 | typedef struct PACKED { |
| 28 | uint8_t type; |
| 29 | uint16_t length; |
| 30 | uint32_t sequence; |
| 31 | uint8_t payload[]; |
| 32 | } packet_t; |
| 33 | |
| 34 | static inline size_t packet_total_size(const packet_t *pkt) { |
| 35 | return sizeof(packet_t) + pkt->length; |
| 36 | } |
| 37 | |
| 38 | static inline void *packet_payload(packet_t *pkt) { |
| 39 | return pkt->payload; |
| 40 | } |