#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
use crate::{ruby_special_consts, VALUE};
pub const Qfalse: ruby_special_consts = ruby_special_consts::RUBY_Qfalse;
pub const Qtrue: ruby_special_consts = ruby_special_consts::RUBY_Qtrue;
pub const Qnil: ruby_special_consts = ruby_special_consts::RUBY_Qnil;
pub const Qundef: ruby_special_consts = ruby_special_consts::RUBY_Qundef;
pub const IMMEDIATE_MASK: ruby_special_consts = ruby_special_consts::RUBY_IMMEDIATE_MASK;
pub const FIXNUM_FLAG: ruby_special_consts = ruby_special_consts::RUBY_FIXNUM_FLAG;
pub const FLONUM_MASK: ruby_special_consts = ruby_special_consts::RUBY_FLONUM_MASK;
pub const FLONUM_FLAG: ruby_special_consts = ruby_special_consts::RUBY_FLONUM_FLAG;
pub const SYMBOL_FLAG: ruby_special_consts = ruby_special_consts::RUBY_SYMBOL_FLAG;
#[allow(clippy::from_over_into)]
impl Into<VALUE> for ruby_special_consts {
fn into(self) -> VALUE {
self as VALUE
}
}
#[inline(always)]
pub fn TEST<T: Into<VALUE>>(obj: T) -> bool {
(obj.into() & !(Qnil as VALUE)) != 0
}
#[inline(always)]
pub fn NIL_P<T: Into<VALUE>>(obj: T) -> bool {
obj.into() == (Qnil as VALUE)
}
#[inline(always)]
pub fn FIXNUM_P<T: Into<VALUE>>(obj: T) -> bool {
(obj.into() & FIXNUM_FLAG as VALUE) != 0
}
pub fn STATIC_SYM_P<T: Into<VALUE>>(obj: T) -> bool {
(obj.into() & 0xff) == SYMBOL_FLAG as VALUE
}
#[inline(always)]
pub fn FLONUM_P<T: Into<VALUE>>(obj: T) -> bool {
(obj.into() & (FLONUM_MASK as VALUE)) == FLONUM_FLAG as VALUE
}
#[inline(always)]
pub fn IMMEDIATE_P<T: Into<VALUE>>(obj: T) -> bool {
obj.into() & (IMMEDIATE_MASK as VALUE) != 0
}
#[inline(always)]
pub fn SPECIAL_CONST_P<T: Into<VALUE>>(obj: T) -> bool {
let value: VALUE = obj.into();
let is_immediate = value & (IMMEDIATE_MASK as VALUE) != 0;
let test = (value & !(Qnil as VALUE)) != 0;
is_immediate || !test
}