aboutsummaryrefslogtreecommitdiff
path: root/stdlib/bytes.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-29 12:55:14 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-29 12:55:14 -0500
commit4b5e4cd1f21582f5e5fa682ab4e4bff252963468 (patch)
treee8fecb01f444c1d392c09255adba5cf6b312b326 /stdlib/bytes.c
parent0b0e0a0a1d41e9574de8dc17c688a4894c5e7f92 (diff)
Change how types handle metamethods
Diffstat (limited to 'stdlib/bytes.c')
-rw-r--r--stdlib/bytes.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stdlib/bytes.c b/stdlib/bytes.c
index 0119cb49..6c94c054 100644
--- a/stdlib/bytes.c
+++ b/stdlib/bytes.c
@@ -10,11 +10,10 @@
public const Byte_t Byte$min = 0;
public const Byte_t Byte$max = UINT8_MAX;
-PUREFUNC public Text_t Byte$as_text(const Byte_t *b, bool colorize, const TypeInfo_t *type)
+PUREFUNC public Text_t Byte$as_text(const void *b, bool colorize, const TypeInfo_t*)
{
- (void)type;
if (!b) return Text("Byte");
- return Text$format(colorize ? "\x1b[35m0x%02X\x1b[m" : "0x%02X", *b);
+ return Text$format(colorize ? "\x1b[35m0x%02X\x1b[m" : "0x%02X", *(Byte_t*)b);
}
public Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix) {
@@ -33,8 +32,9 @@ public Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix) {
public const TypeInfo_t Byte$info = {
.size=sizeof(Byte_t),
.align=__alignof__(Byte_t),
- .tag=CustomInfo,
- .CustomInfo={.as_text=(void*)Byte$as_text},
+ .metamethods={
+ .as_text=Byte$as_text,
+ },
};
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0