diff --git a/src/post_modules/CritBit/bignumtree.cmod b/src/post_modules/CritBit/bignumtree.cmod index 303f4c9ba17555cb7461aaaa200c5d7f7f4f0e38..52e804a5089d1413ed71a12dad4c392809bd3158 100644 --- a/src/post_modules/CritBit/bignumtree.cmod +++ b/src/post_modules/CritBit/bignumtree.cmod @@ -37,7 +37,7 @@ PIKECLASS BigNumTree { #cmod_define iterator_class Iterator #cmod_define tree_class BigNumTree #cmod_define cmod_OBJ2_TREE OBJ2_BIGNUMTREE -#cmod_define T_KEY PIKE_T_OBJECT +#cmod_define T_KEY BIT_OBJECT #cmod_define key_ptype bignum #cmod_define sval_type object /* diff --git a/src/post_modules/CritBit/floattree.cmod b/src/post_modules/CritBit/floattree.cmod index fded0699f3e6588fbf6e87b037ee9bdda78fbd7e..d30878c93fd0991778e7c0d9a6220e0e68027d60 100644 --- a/src/post_modules/CritBit/floattree.cmod +++ b/src/post_modules/CritBit/floattree.cmod @@ -21,7 +21,7 @@ PIKECLASS FloatTree { #cmod_define iterator_class Iterator #cmod_define tree_class FloatTree #cmod_define cmod_OBJ2_TREE OBJ2_FLOATTREE -#cmod_define T_KEY (PIKE_T_FLOAT|PIKE_T_INT) +#cmod_define T_KEY (BIT_FLOAT|BIT_INT) #cmod_define key_ptype float|int #cmod_define sample_key 12.0 #cmod_define sample_keys ({ 80.4, 99.9, 14.2 }) diff --git a/src/post_modules/CritBit/inttree.cmod b/src/post_modules/CritBit/inttree.cmod index 0fb75550aff5a1ede91794c80b393532df8772bc..b9726355285a6c48ddf730ccd5c03d55cf831dcd 100644 --- a/src/post_modules/CritBit/inttree.cmod +++ b/src/post_modules/CritBit/inttree.cmod @@ -27,7 +27,7 @@ PIKECLASS IntTree { #cmod_define iterator_class Iterator #cmod_define tree_class IntTree #cmod_define cmod_OBJ2_TREE OBJ2_INTTREE -#cmod_define T_KEY PIKE_T_INT +#cmod_define T_KEY BIT_INT #cmod_define key_ptype int #cmod_define sval_type integer #cmod_define sample_key 12 @@ -97,7 +97,7 @@ PIKECLASS IPv4Tree { #cmod_define iterator_class Iterator #cmod_define tree_class IPv4Tree #cmod_define cmod_OBJ2_TREE OBJ2_IPV4TREE -#cmod_define T_KEY PIKE_T_STRING +#cmod_define T_KEY BIT_STRING #cmod_define key_ptype string #cmod_define sval_type string #cmod_define sample_key "127.0.0.0/8" diff --git a/src/post_modules/CritBit/iterator_source.H b/src/post_modules/CritBit/iterator_source.H index 8045b5d44e5616297a805bbabef4509442afc553..2d5b548cddad9daf35ba481bb89fe5113f3254f4 100644 --- a/src/post_modules/CritBit/iterator_source.H +++ b/src/post_modules/CritBit/iterator_source.H @@ -164,7 +164,7 @@ apply_low(tree, encode_fun, 1); assign_svalue(stop, Pike_sp-1); pop_stack(); - if (!(stop->type == T_KEY)) + if (!((1<<stop->type) & T_KEY)) SIMPLE_BAD_ARG_ERROR("create", 3, cmod_STRFY_EVAL(key_ptype)); } THIS->stop = CB_LOW_KEY_FROM_SVALUE(stop); @@ -179,7 +179,7 @@ apply_low(tree, encode_fun, 1); assign_svalue(start, Pike_sp-1); pop_stack(); - if (!(start->type == T_KEY)) + if (!((1<<start->type) & T_KEY)) SIMPLE_BAD_ARG_ERROR("create", 2, cmod_STRFY_EVAL(key_ptype)); } s = CB_LOW_KEY_FROM_SVALUE(start); diff --git a/src/post_modules/CritBit/stringtree.cmod b/src/post_modules/CritBit/stringtree.cmod index 48858d7413b1af4c282e9d27bb8336e852c00213..ae0a8409b14ecd0442ed0cefa83040c63af69e98 100644 --- a/src/post_modules/CritBit/stringtree.cmod +++ b/src/post_modules/CritBit/stringtree.cmod @@ -42,7 +42,7 @@ PIKECLASS StringTree { #cmod_define iterator_class Iterator #cmod_define tree_class StringTree #cmod_define cmod_OBJ2_TREE OBJ2_STRINGTREE -#cmod_define T_KEY PIKE_T_STRING +#cmod_define T_KEY BIT_STRING #cmod_define key_ptype string #cmod_define sval_type string #cmod_define sample_key "foo" diff --git a/src/post_modules/CritBit/tree_header.H b/src/post_modules/CritBit/tree_header.H index 016cf971a95be8bf1a39f6ad0b30125d7ed131db..eda717d335f35963854f67951bec5405524e9382 100644 --- a/src/post_modules/CritBit/tree_header.H +++ b/src/post_modules/CritBit/tree_header.H @@ -73,7 +73,7 @@ DOCEND() #undef CB_CHECK_KEY #define CB_CHECK_KEY(svalue, fun, num) do { \ CB_TRANSFORM_KEY(svalue); \ - if (!((svalue)->type == T_KEY)) \ + if (!((1<<(svalue)->type) & T_KEY)) \ SIMPLE_BAD_ARG_ERROR(fun, (num), STRFY(key_ptype)); \ } while(0) #undef CB_PUSH_TRANSFORM_KEY @@ -91,12 +91,12 @@ TREE_CLASSIFY(_transform_svalue_to_key)(const struct svalue * s) { if (THIS->encode_fun >= 0) { push_svalue(s); apply_low(Pike_fp->current_object, THIS->encode_fun, 1); - if (!(Pike_sp[-1].type == T_KEY)) + if (!((1<<Pike_sp[-1].type) & T_KEY)) Pike_error("encode_key() is expected to return type " cmod_STRFY_EVAL(key_ptype) ".\n"); key = CB_LOW_KEY_FROM_SVALUE(Pike_sp-1); pop_stack(); } else { - if (!(s->type == T_KEY)) Pike_error("Expected type " cmod_STRFY_EVAL(key_ptype) ".\n"); + if (!((1<<s->type) & T_KEY)) Pike_error("Expected type " cmod_STRFY_EVAL(key_ptype) ".\n"); key = CB_LOW_KEY_FROM_SVALUE(s); } return key; diff --git a/src/post_modules/CritBit/tree_source.H b/src/post_modules/CritBit/tree_source.H index 430b9c449aee3d37614548133de10d9c002307c9..b6b06bd3eb3aec9000aca0b704fe8bdf422964e0 100644 --- a/src/post_modules/CritBit/tree_source.H +++ b/src/post_modules/CritBit/tree_source.H @@ -279,7 +279,7 @@ DOCEND() */ PIKEFUN mixed `[](mixed key) { CB_TRANSFORM_KEY(key); - if (key->type == T_KEY) { + if ((1<<key->type) & T_KEY) { cb_node_t n; cb_key k = CB_LOW_KEY_FROM_SVALUE(key); pop_stack();