From 597699243a6f935231ad83e63d22bf6ff9e4e547 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 1 Oct 2025 13:40:29 -0400 Subject: For structs and fixed-size ints, use `.has_value` instead of `.is_none` --- src/stdlib/optionals.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/stdlib/optionals.c') diff --git a/src/stdlib/optionals.c b/src/stdlib/optionals.c index 41d38a19..3fe812b1 100644 --- a/src/stdlib/optionals.c +++ b/src/stdlib/optionals.c @@ -13,8 +13,8 @@ public PUREFUNC bool is_none(const void *obj, const TypeInfo_t *non_optional_type) { if (non_optional_type->metamethods.is_none) return non_optional_type->metamethods.is_none(obj, non_optional_type); - const void *dest = (obj + non_optional_type->size); - return *(bool *)dest; + const bool *has_value = (const bool *)(obj + non_optional_type->size); + return !(*has_value); } PUREFUNC public uint64_t Optional$hash(const void *obj, const TypeInfo_t *type) { -- cgit v1.2.3