From ef23faa3e6e003282e53fc08031ec4eb9a2e2aae Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 7 Apr 2025 00:46:26 -0400 Subject: Add Byte.to() method and improved micro optimization of iterating over fixed-width integer ranges --- src/stdlib/bytes.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/stdlib/bytes.h') diff --git a/src/stdlib/bytes.h b/src/stdlib/bytes.h index ac1b61a3..f875e7cb 100644 --- a/src/stdlib/bytes.h +++ b/src/stdlib/bytes.h @@ -6,6 +6,7 @@ #include #include "datatypes.h" +#include "integers.h" #include "stdlib.h" #include "types.h" #include "util.h" @@ -18,6 +19,7 @@ Byte_t Byte$from_int(Int_t i, bool truncate); Byte_t Byte$from_int64(int64_t i, bool truncate); Byte_t Byte$from_int32(int32_t i, bool truncate); Byte_t Byte$from_int16(int16_t i, bool truncate); +Closure_t Byte$to(Byte_t first, Byte_t last, OptionalInt8_t step); MACROLIKE Byte_t Byte$from_int8(int8_t i) { return (Byte_t)i; } MACROLIKE Byte_t Byte$from_bool(bool b) { return (Byte_t)b; } @@ -28,11 +30,4 @@ extern const TypeInfo_t Byte$info; Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix); -typedef struct { - Byte_t value; - bool has_value:1; -} OptionalByte_t; - -#define NONE_BYTE ((OptionalByte_t){.has_value=false}) - // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 -- cgit v1.2.3