add <? (min) and >? (max) operators

This commit is contained in:
2018-05-02 14:48:16 +02:00
parent f4f01fc684
commit 6d7b883bd8
2 changed files with 8 additions and 6 deletions
+2
View File
@@ -90,6 +90,7 @@ struct {char str[4]; int pr;} ops[] = {
{"*", 13},{"/",13},{"%",13},
{"+",12},{"-",12},
{"<<",11},{">>>",11},{">>",11},
{"<?",10},{">?",10},
{"<=>",9},
{"<=",8},{">=",8},{"<",8},{">",8},
{"==",7},{"!=",7},
@@ -104,6 +105,7 @@ enum op {
op_mul,op_div,op_mod,
op_plus,op_minus,
op_lshift,op_urshift,op_rshift,
op_min,op_max,
op_cmp,
op_lteq,op_gteq,op_lt,op_gt,
op_eq,op_neq,
+6 -6
View File
@@ -18,14 +18,14 @@ x=%x -10<<2, %x -10>>2, %x -10>>>2
x=%x 0xaa & 0x0f, %x 0xaa | 0x0f, %x 0xaa ^ 0x0f
# $(x) should be: a, af, a5
x=10<20 10<=20 10==20 10>=20 10>20 10<=>20
# $(x) should be: 1 1 0 0 0 -1
x=10<20 10<=20 10==20 10>=20 10>20 10<=>20 10<?20 10>?20 10?<20 10?>20
# $(x) should be: 1 1 0 0 0 -1 10 20 1 0
x=20<20 20<=20 20==20 20>=20 20>20 20<=>20
# $(x) should be: 0 1 1 1 0 0
x=20<20 20<=20 20==20 20>=20 20>20 20<=>20 20<?20 20>?20 20?<20 20?>20
# $(x) should be: 0 1 1 1 0 0 20 20 1 0
x=20<10 20<=10 20==10 20>=10 20>10 20<=>10
# $(x) should be: 0 0 0 1 1 1
x=20<10 20<=10 20==10 20>=10 20>10 20<=>10 20<?10 20>?10 20?<10 20?>10
# $(x) should be: 0 0 0 1 1 1 10 20 1 0
x= (0|0)(0|1)(1|0)(1|1) (0&0)(0&1)(1&0)(1&1) (0^0)(0^1)(1^0)(1^1)
# $(x) should be: 0111 0001 0110