1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SafeC Standard Library — Fixed-width integer format specifiers (C99/C11/C17/C23)
// Use these macros with printf/scanf and the io_printf/io_scan family.
#pragma once
#include <std/stdint.h>
// ── printf: signed decimal ────────────────────────────────────────────────────
#define PRId8 "hhd"
#define PRId16 "hd"
#define PRId32 "d"
#define PRId64 "lld"
#define PRIdMAX "lld"
#define PRIdPTR "lld"
// ── printf: unsigned decimal ──────────────────────────────────────────────────
#define PRIu8 "hhu"
#define PRIu16 "hu"
#define PRIu32 "u"
#define PRIu64 "llu"
#define PRIuMAX "llu"
#define PRIuPTR "llu"
// ── printf: unsigned octal ────────────────────────────────────────────────────
#define PRIo8 "hho"
#define PRIo16 "ho"
#define PRIo32 "o"
#define PRIo64 "llo"
#define PRIoMAX "llo"
// ── printf: unsigned hex (lowercase) ─────────────────────────────────────────
#define PRIx8 "hhx"
#define PRIx16 "hx"
#define PRIx32 "x"
#define PRIx64 "llx"
#define PRIxMAX "llx"
#define PRIxPTR "llx"
// ── printf: unsigned hex (uppercase) ─────────────────────────────────────────
#define PRIX8 "hhX"
#define PRIX16 "hX"
#define PRIX32 "X"
#define PRIX64 "llX"
#define PRIXMAX "llX"
// ── scanf: signed decimal ─────────────────────────────────────────────────────
#define SCNd8 "hhd"
#define SCNd16 "hd"
#define SCNd32 "d"
#define SCNd64 "lld"
#define SCNdMAX "lld"
#define SCNdPTR "lld"
// ── scanf: unsigned decimal ───────────────────────────────────────────────────
#define SCNu8 "hhu"
#define SCNu16 "hu"
#define SCNu32 "u"
#define SCNu64 "llu"
#define SCNuMAX "llu"
#define SCNuPTR "llu"
// ── scanf: unsigned hex (lowercase) ──────────────────────────────────────────
#define SCNx8 "hhx"
#define SCNx16 "hx"
#define SCNx32 "x"
#define SCNx64 "llx"
#define SCNxMAX "llx"