Mercurial > hg-old > index.cgi
changeset 23:ec0bf61a5502
Added ^ (bitwise complement)
author | lost |
---|---|
date | Fri, 02 Jan 2009 01:32:07 +0000 |
parents | b704f7ffc8ba |
children | 98dcaa0dc396 |
files | src/expr.c src/expr.h |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/expr.c Fri Jan 02 00:43:19 2009 +0000 +++ b/src/expr.c Fri Jan 02 01:32:07 2009 +0000 @@ -207,6 +207,18 @@ return 0; } + if (**p == '^') + { + // parse expression following "^" + (*p)++; + if (lwasm_expr_parse_expr(s, p, 200) < 0) + return -1; + t = lwasm_expr_term_create_oper(LWASM_OPER_COM); + lwasm_expr_stack_push(s, t); + lwasm_expr_term_free(t); + return 0; + } + /* we have an actual term here so evaluate it
--- a/src/expr.h Fri Jan 02 00:43:19 2009 +0000 +++ b/src/expr.h Fri Jan 02 01:32:07 2009 +0000 @@ -50,8 +50,8 @@ #define LWASM_OPER_BWXOR 9 // bitwise XOR #define LWASM_OPER_AND 10 // boolean AND #define LWASM_OPER_OR 11 // boolean OR -#define LWASM_OPER_NEG 12 // unary negation (2's complement) -#define LWASM_OPER_COM 13 // unary 1's complement +#define LWASM_OPER_NEG 12 // - unary negation (2's complement) +#define LWASM_OPER_COM 13 // ^ unary 1's complement // term structure