diff --git a/src/array.c b/src/array.c index 3bbc0ab5e18e1703b972ed720fb8e339c055859f..c31e0929f68d46e56594a47067e9aa11f340cd79 100644 --- a/src/array.c +++ b/src/array.c @@ -22,7 +22,7 @@ #include "security.h" #include "stuff.h" -RCSID("$Id: array.c,v 1.55 1999/09/24 13:03:01 noring Exp $"); +RCSID("$Id: array.c,v 1.56 1999/10/03 21:44:17 hubbe Exp $"); struct array empty_array= { @@ -1134,12 +1134,12 @@ static int array_merge_fun(INT32 *a, INT32 *b) { return orderb[~*a] - orderb[~*b]; }else{ - return -1; + return 1; } }else{ if(*b<0) { - return 1; + return -1; }else{ return ordera[*a] - ordera[*b]; } @@ -1340,7 +1340,7 @@ struct array *and_arrays(struct array *a, struct array *b) if(a->type_field & b->type_field) { - return merge_array_without_order(a, b, PIKE_ARRAY_OP_AND); + return merge_array_with_order(a, b, PIKE_ARRAY_OP_AND_LEFT); }else{ return allocate_array_no_init(0,0); } diff --git a/src/array.h b/src/array.h index 2b09ba8342c8171c4bc2fa722e1f71a2b2744296..5b65711c48a0d73b800802453bb5572a03a87b20 100644 --- a/src/array.h +++ b/src/array.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: array.h,v 1.17 1999/04/12 02:24:11 hubbe Exp $ + * $Id: array.h,v 1.18 1999/10/03 21:44:18 hubbe Exp $ */ #ifndef ARRAY_H #define ARRAY_H @@ -56,7 +56,9 @@ extern struct array empty_array; #define PIKE_MINTERM(X,Y,Z) (((X)<<8)+((Y)<<4)+(Z)) #define PIKE_ARRAY_OP_AND PIKE_MINTERM(PIKE_ARRAY_OP_SKIP_A,PIKE_ARRAY_OP_SKIP_A | PIKE_ARRAY_OP_TAKE_B,PIKE_ARRAY_OP_SKIP_B) +#define PIKE_ARRAY_OP_AND_LEFT PIKE_MINTERM(PIKE_ARRAY_OP_SKIP_A,PIKE_ARRAY_OP_SKIP_B | PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_SKIP_B) #define PIKE_ARRAY_OP_OR PIKE_MINTERM(PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_SKIP_A | PIKE_ARRAY_OP_TAKE_B,PIKE_ARRAY_OP_TAKE_B) +#define PIKE_ARRAY_OP_OR_LEFT PIKE_MINTERM(PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_SKIP_B | PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_TAKE_B) #define PIKE_ARRAY_OP_XOR PIKE_MINTERM(PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_SKIP_A | PIKE_ARRAY_OP_SKIP_B,PIKE_ARRAY_OP_TAKE_B) #define PIKE_ARRAY_OP_ADD PIKE_MINTERM(PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_TAKE_A | PIKE_ARRAY_OP_TAKE_B ,PIKE_ARRAY_OP_TAKE_B) #define PIKE_ARRAY_OP_SUB PIKE_MINTERM(PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_SKIP_A ,PIKE_ARRAY_OP_SKIP_B) diff --git a/src/testsuite.in b/src/testsuite.in index 7474841cf633b8cef5e14d49b63368fc77ec92b7..34335a44d869a824a2608e1e143f1df01e761d1a 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.198 1999/09/21 21:16:27 hubbe Exp $"]]) +test_true([["$Id: testsuite.in,v 1.199 1999/10/03 21:44:19 hubbe Exp $"]]) cond([[all_constants()->_verify_internals]], [[ @@ -1737,7 +1737,7 @@ test_eq(0 | 0,0) test_eq(1 | 1,1) test_eq(4 | 1,5) test_eq(1 | 9,9) -test_equal( Array.sort_array(({1,2,3,4,4}) | ({3,5,6})), ({1,2,3,4,4,5,6})) +test_equal( ({1,2,3,4,4}) | ({3,5,6}), ({1,2,4,4,3,5,6})) test_equal( (<4,5,6>) | (<5,5,5>), (<4,5,5,5,6>) ) test_equal( ([-4:8,8:7]) | ([3:3,8:3]), ([-4:8,8:3,3:3]) )