89 lines · 2.4 KB · C
RawDownload
#pragma once typedef uint8_t u8int;typedef uint16_t u16int;typedef uint32_t u32int;typedef uint64_t u64int;typedef uintptr_t uintptr; typedef int8_t s8int;typedef int16_t s16int;typedef int32_t s32int;typedef int64_t s64int;typedef intptr_t intptr; typedef ssize_t ssize;typedef size_t usize;typedef off_t soffset; #define sl_unlikely(x) __builtin_expect(!!(x), 0)#define sl_likely(x) __builtin_expect(!!(x), 1)#define sl_printfmt(x, y) __attribute__((format(printf, x, y)))#if defined(NDEBUG) && !defined(__macos__) && !defined(__dos__)#define sl_thread(x) __thread x#else#define sl_thread(x) x#endif#if defined(__TINYC__)#define sl_prefetch(x) do{}while(0)#else#define sl_prefetch(x) __builtin_prefetch(x)#endif#define sl_packed __attribute__((packed))#define sl_fallthrough __attribute__((fallthrough))#define sl_constfn __attribute__((const))#define sl_purefn __attribute__((pure))#define sl_hotfn __attribute__((hot))#define sl_returns_nonnull __attribute__((returns_nonnull))#define sl_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))#define sl_aligned(x) __attribute__((aligned(x)))#define sl_popcount(x) __builtin_popcount(x)#define sl_clz(x) __builtin_clz(x)#define sl_alloc __attribute__((malloc))#define sl_offsetof(x, y) __builtin_offsetof(x, y) #if !defined(__has_attribute)#define __has_attribute(x) 0#endif #if __has_attribute(access)#define sl_rd(...) __attribute__((access(read_only, __VA_ARGS__)))#define sl_wr(...) __attribute__((access(write_only, __VA_ARGS__)))#else#define sl_rd(...)#define sl_wr(...)#endif #if __has_attribute(null_terminated_string_arg)#define sl_cstr(x) __attribute__((null_terminated_string_arg(x)))#else#define sl_cstr(x)#endif #if __has_attribute(fd_arg) && __has_attribute(fd_arg_read) && __has_attribute(fd_arg_write)#define sl_fd(x) __attribute__((fd_arg(x)))#define sl_fd_rd(x) __attribute__((fd_arg_read(x)))#define sl_fd_wr(x) __attribute__((fd_arg_write(x)))#else#define sl_fd(x)#define sl_fd_rd(x)#define sl_fd_wr(x)#endif #if __has_attribute(flag_enum)#define sl_enum_flags __attribute__((flag_enum))#else#define sl_enum_flags#endif #if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN)#error unknown endian#endif #if !defined(__TINYC__)#define sadd_overflow __builtin_add_overflow#define sadd_overflow_64 __builtin_add_overflow#define smul_overflow_64 __builtin_mul_overflow#else#include "overflow.h"#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t