From 4665a620775da64ec7280762979a9fc6fa37c0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 31 Mar 2022 02:01:31 +0300 Subject: Switch boolean type to uintptr_t Dumb me, of course boolean could overflow and result in a false (0) case even if there was something. --- include/object.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/object.h b/include/object.h index 157ac0a..71fc969 100644 --- a/include/object.h +++ b/include/object.h @@ -35,8 +35,12 @@ struct roscha_object { enum roscha_type type; size_t refcount; union { - /* booleans are only used internally */ - bool boolean; + /* + * booleans are only used internally. It's not a bool so that we can + * evaluate as truthy objects such as integers and the other types + * without overflow problems of bool. + */ + uintptr_t boolean; /* integer numbers */ int64_t integer; /* A dynamic string using the sds library */ -- cgit v1.2.3