Replace some #define with constexpr

This commit is contained in:
Rangi42
2025-01-03 21:35:17 -05:00
committed by Rangi
parent a5f12f66bb
commit 4e2464a69d
8 changed files with 38 additions and 40 deletions

View File

@@ -15,7 +15,7 @@
// This value is a compromise between `LexerState` allocation performance when `mmap` works, and
// buffering performance when it doesn't/can't (e.g. when piping a file into RGBASM).
#define LEXER_BUF_SIZE 64
static constexpr size_t LEXER_BUF_SIZE = 64;
// The buffer needs to be large enough for the maximum `lexerState->peek()` lookahead distance
static_assert(LEXER_BUF_SIZE > 1, "Lexer buffer size is too small");
// This caps the size of buffer reads, and according to POSIX, passing more than SSIZE_MAX is UB