M_UNSPECIFIED_BITS) #define SCM_UNDEFINED SCM_PACK (SCM_UNDEFINED_BITS) #define SCM_EOF_VAL SCM_PACK (SCM_EOF_VAL_BITS) #define SCM_UNBNDP(x) (scm_is_eq ((x), SCM_UNDEFINED)) /* SCM_MATCHES_BITS_IN_COMMON(x,a,b) returns 1 if and only if x matches both a and b in every bit position where a and b are equal; otherwise it returns 0. Bit positions where a and b differ are ignored. This is used to efficiently compare against two values which differ in exactly one bit position, or against four values which differ in exactly two bit positions. It is the basis for the following macros: scm_is_null_or_nil, scm_is_false_or_nil, scm_is_true_and_not_nil, scm_is_lisp_false, scm_is_lisp_true, scm_is_bool_and_not_nil (aka scm_is_bool) scm_is_bool_or_nil. */ #define SCM_MATCHES_BITS_IN_COMMON(x,a,b) \ ((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ (SCM_UNPACK(a) & SCM_UNPACK(b))) /* These macros are used for compile-time verification that the constants have the properties needed for the above macro to work properly. */ #ifdef BUILDING_LIBGUILE #define SCM_WITH_LEAST_SIGNIFICANT_1_BIT_CLEARED(x) ((x) & ((x)-1)) #define SCM_HAS_EXACTLY_ONE_BIT_SET(x) \ ((x) != 0 && SCM_WITH_LEAST_SIGNIFICANT_1_BIT_CLEARED (x) == 0) #define SCM_HAS_EXACTLY_TWO_BITS_SET(x) \ (SCM_HAS_EXACTLY_ONE_BIT_SET (SCM_WITH_LEAST_SIGNIFICANT_1_BIT_CLEARED (x))) #define SCM_BITS_DIFFER_IN_EXACTLY_ONE_BIT_POSITION(a,b) \ (SCM_HAS_EXACTLY_ONE_BIT_SET ((a) ^ (b))) #define SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS(a,b,c,d) \ (SCM_HAS_EXACTLY_TWO_BITS_SET (((a) ^ (b)) | \ ((b) ^ (c)) | \ ((c) ^ (d)))) #endif /* BUILDING_LIBGUILE */