diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-01 13:40:29 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-01 13:40:29 -0400 |
| commit | 597699243a6f935231ad83e63d22bf6ff9e4e547 (patch) | |
| tree | edd50fcdad4324680d9e2df7beeaaf93fb162938 /src/stdlib/optionals.c | |
| parent | 1b307918c9f0ee6cf3dd074e0b9d9db1ffd35fb8 (diff) | |
For structs and fixed-size ints, use `.has_value` instead of `.is_none`
Diffstat (limited to 'src/stdlib/optionals.c')
| -rw-r--r-- | src/stdlib/optionals.c | 4 |
1 files changed, 2 insertions, 2 deletions
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) { |
