aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/bytes.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-07 03:21:58 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-07 03:21:58 -0400
commit82f5f05bb9440b758ae5e4a7c168e36ecff06db5 (patch)
treee9f997f469a1c26016ff2b58c716bfb643930272 /src/stdlib/bytes.c
parent6c3e2cdf12a09e0cfceb2032140ac7dfa222620b (diff)
Move clamped() and is_between() to proper functions (not just macros)
Diffstat (limited to 'src/stdlib/bytes.c')
-rw-r--r--src/stdlib/bytes.c4
1 files changed, 4 insertions, 0 deletions
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);