aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/bytes.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-17 20:35:09 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-17 20:35:09 -0400
commitf4e38fd061a158ecb94881273c6db6e6a332f61d (patch)
tree9179cb312dcc1b24d806dfb65694c25580d1ed8b /src/stdlib/bytes.c
parent602cedd03b0c3d6ef176efafb08f51bde9bfe543 (diff)
Switch from using dollar signs as namespace delimiters to using 々, ヽ, andunicode-identifiers
〇.
Diffstat (limited to 'src/stdlib/bytes.c')
-rw-r--r--src/stdlib/bytes.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/stdlib/bytes.c b/src/stdlib/bytes.c
index 130a645f..9492c14c 100644
--- a/src/stdlib/bytes.c
+++ b/src/stdlib/bytes.c
@@ -8,10 +8,10 @@
#include "text.h"
#include "util.h"
-public const Byte_t Byte$min = 0;
-public const Byte_t Byte$max = UINT8_MAX;
+public const Byte_t Byteヽmin = 0;
+public const Byte_t Byteヽmax = UINT8_MAX;
-PUREFUNC public Text_t Byte$as_text(const void *b, bool colorize, const TypeInfo_t *info)
+PUREFUNC public Text_t Byteヽas_text(const void *b, bool colorize, const TypeInfo_t *info)
{
(void)info;
if (!b) return Text("Byte");
@@ -21,28 +21,28 @@ PUREFUNC public Text_t Byte$as_text(const void *b, bool colorize, const TypeInfo
(byte & 15) <= 9 ? '0' + (byte & 15) : 'a' + (byte & 15) - 10,
'\0',
};
- Text_t text = Text$from_str(digits);
+ Text_t text = Textヽfrom_str(digits);
if (colorize) text = Texts(Text("\x1b[35m"), text, Text("\x1b[m"));
return text;
}
-public CONSTFUNC bool Byte$is_between(const Byte_t x, const Byte_t low, const Byte_t high) {
+public CONSTFUNC bool Byteヽis_between(const Byte_t x, const Byte_t low, const Byte_t high) {
return low <= x && x <= high;
}
-public OptionalByte_t Byte$parse(Text_t text, Text_t *remainder)
+public OptionalByte_t Byteヽparse(Text_t text, Text_t *remainder)
{
- OptionalInt_t full_int = Int$parse(text, remainder);
+ OptionalInt_t full_int = Intヽparse(text, remainder);
if (full_int.small != 0L
- && Int$compare_value(full_int, I(0)) >= 0
- && Int$compare_value(full_int, I(255)) <= 0) {
- return (OptionalByte_t){.value=Byte$from_int(full_int, true)};
+ && Intヽcompare_value(full_int, I(0)) >= 0
+ && Intヽcompare_value(full_int, I(255)) <= 0) {
+ return (OptionalByte_t){.value=Byteヽfrom_int(full_int, true)};
} else {
return NONE_BYTE;
}
}
-public Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix) {
+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);
char *p = (char*)text.ascii;
@@ -62,12 +62,12 @@ public Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix) {
return text;
}
-public bool Byte$get_bit(Byte_t x, Int_t bit_index) {
- if (Int$compare_value(bit_index, I(1)) < 0)
+public bool Byteヽget_bit(Byte_t x, Int_t bit_index) {
+ if (Intヽcompare_value(bit_index, I(1)) < 0)
fail("Invalid bit index (expected 1 or higher): ", bit_index);
- if (Int$compare_value(bit_index, I(8)) > 0)
+ if (Intヽcompare_value(bit_index, I(8)) > 0)
fail("Bit index is too large! There are only 8 bits in a byte, but index is: ", bit_index);
- return ((x & (Byte_t)(1L << (Int64$from_int(bit_index, true)-1L))) != 0);
+ return ((x & (Byte_t)(1L << (Int64ヽfrom_int(bit_index, true)-1L))) != 0);
}
#ifdef __TINYC__
@@ -91,7 +91,7 @@ static OptionalByte_t _next_Byte(ByteRange_t *info) {
return i;
}
-public CONSTFUNC Closure_t Byte$to(Byte_t first, Byte_t last, OptionalInt8_t step) {
+public CONSTFUNC Closure_t Byteヽto(Byte_t first, Byte_t last, OptionalInt8_t step) {
ByteRange_t *range = GC_MALLOC(sizeof(ByteRange_t));
range->current = (OptionalByte_t){.value=first};
range->last = (OptionalByte_t){.value=last};
@@ -99,34 +99,34 @@ public CONSTFUNC Closure_t Byte$to(Byte_t first, Byte_t last, OptionalInt8_t ste
return (Closure_t){.fn=_next_Byte, .userdata=range};
}
-public PUREFUNC Byte_t Byte$from_int(Int_t i, bool truncate) {
- if unlikely (!truncate && Int$compare_value(i, I_small(0xFF)) > 0)
+public PUREFUNC Byte_t Byteヽfrom_int(Int_t i, bool truncate) {
+ if unlikely (!truncate && Intヽcompare_value(i, I_small(0xFF)) > 0)
fail("This value is too large to convert to a byte without truncation: ", i);
- else if unlikely (!truncate && Int$compare_value(i, I_small(0)) < 0)
+ else if unlikely (!truncate && Intヽcompare_value(i, I_small(0)) < 0)
fail("Negative values can't be converted to bytes: ", i);
return (Byte_t)(i.small >> 2);
}
-public PUREFUNC Byte_t Byte$from_int64(Int64_t i, bool truncate) {
+public PUREFUNC Byte_t Byteヽfrom_int64(Int64_t i, bool truncate) {
if unlikely (!truncate && i != (Int64_t)(Byte_t)i)
fail("This value can't be converted to a byte without truncation: ", i);
return (Byte_t)i;
}
-public PUREFUNC Byte_t Byte$from_int32(Int32_t i, bool truncate) {
+public PUREFUNC Byte_t Byteヽfrom_int32(Int32_t i, bool truncate) {
if unlikely (!truncate && i != (Int32_t)(Byte_t)i)
fail("This value can't be converted to a byte without truncation: ", i);
return (Byte_t)i;
}
-public PUREFUNC Byte_t Byte$from_int16(Int16_t i, bool truncate) {
+public PUREFUNC Byte_t Byteヽfrom_int16(Int16_t i, bool truncate) {
if unlikely (!truncate && i != (Int16_t)(Byte_t)i)
fail("This value can't be converted to a byte without truncation: ", i);
return (Byte_t)i;
}
-public const TypeInfo_t Byte$info = {
+public const TypeInfo_t Byteヽinfo = {
.size=sizeof(Byte_t),
.align=__alignof__(Byte_t),
.metamethods={
- .as_text=Byte$as_text,
+ .as_text=Byteヽas_text,
},
};