summaryrefslogtreecommitdiff
path: root/src/palette.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 13:36:27 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 13:36:27 +0300
commit4741f7a6dfa144ce65cf3bbdd4a1bc6bee6df2e5 (patch)
tree97932e58eee98623b56a9d9181a3b4289b6ecfc1 /src/palette.h
parenta0fefd3856a4f03be0abbc51f7a9a0416db69eb5 (diff)
Optimize and simplify loops, table lookups, and branchless parsers
- Replace sequential colon-counting loop with branchless CTZ bitmask in src/pen.h - Replace linear strchr with 256-bit ASCII punctuation bitmask in src/selection.c - Flatten 3D color cube loop and precompute constants in src/palette.c - Use static 256-byte LUT for hex decoding and bsearch for termcap in src/escape.c - Replace capacity doubling while loops with branchless CLZ pow2 helpers across core - Use direct memset/memcpy in src/snapshot.c - Optimize input digit/byte formatting, alt-prefix path, and make keyboard state optional in src/input.c
Diffstat (limited to 'src/palette.h')
-rw-r--r--src/palette.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/palette.h b/src/palette.h
index 5eef03e..f60e41e 100644
--- a/src/palette.h
+++ b/src/palette.h
@@ -28,7 +28,7 @@ void term_palette_reset_all(struct palette *p);
static inline uint32_t palette_resolve(const struct palette *p, term_color c)
{
- return term_color_is_slot(c) ? p->colors[c & 0x1FFu] : c;
+ return term_color_is_slot(c) ? p->colors[c & TERM_COLOR_SLOT_INDEX] : c;
}
#endif