From 82f5f05bb9440b758ae5e4a7c168e36ecff06db5 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 7 Apr 2025 03:21:58 -0400 Subject: Move clamped() and is_between() to proper functions (not just macros) --- src/stdlib/bytes.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/stdlib/bytes.c') diff --git a/src/stdlib/bytes.c b/src/stdlib/bytes.c index 1203aa55..b543c7c6 100644 --- a/src/stdlib/bytes.c +++ b/src/stdlib/bytes.c @@ -16,6 +16,10 @@ PUREFUNC public Text_t Byte$as_text(const void *b, bool colorize, const TypeInfo return Text$format(colorize ? "\x1b[35m0x%02X\x1b[m" : "0x%02X", *(Byte_t*)b); } +public CONSTFUNC bool Byte$is_between(const Byte_t x, const Byte_t low, const Byte_t high) { + return low <= x && x <= high; +} + public Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix) { struct Text_s text = {.tag=TEXT_ASCII}; text.ascii = GC_MALLOC_ATOMIC(8); -- cgit v1.2.3