From 412e3c7a8db275567eaceece6c48dde3aedf2ae6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 19 Oct 2022 18:45:26 +0900 Subject: Assert for RTEST that Qnil and Qfalse differ just 1 bit --- ruby.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index 0a3248f95f..03aeb9b75b 100644 --- a/ruby.c +++ b/ruby.c @@ -62,6 +62,9 @@ #include "ruby/version.h" #include "ruby/internal/error.h" +#define singlebit_only_p(x) !((x) & ((x)-1)) +STATIC_ASSERT(Qnil_1bit_from_Qfalse, singlebit_only_p(Qnil^Qfalse)); + #ifndef MAXPATHLEN # define MAXPATHLEN 1024 #endif -- cgit v1.2.3