duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit fad50416e39be23ec087f04784c294373e7327a0
parent 8b9a6db7482dad27c29e73b13619bb001bbd674b
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun, 19 Mar 2023 08:07:43 -0400

halcc: bwnot()

Diffstat:
Mfs/comp/c/egen.fs | 4+++-
Mfs/tests/comp/c/cc.fs | 2+-
Mfs/tests/comp/c/test2.c | 4++++
3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/comp/c/egen.fs b/fs/comp/c/egen.fs @@ -47,9 +47,11 @@ alias noop parseFactor ( tok -- res ) \ forward declaration CELLSZ + @ over Result arg swap execute over to Result arg else @ over Result :>W execute then ( res ) ; unaryop _neg, neg, neg +: _ -1 xorn, ; +unaryop _not, _ ^ UOPSCNT wordtbl _tbl ( res -- res ) -'w _neg, 'w _err 'w _err 'w _err 'w _err 'w _err 'w _err +'w _neg, 'w _not, 'w _err 'w _err 'w _err 'w _err 'w _err \ A factor can be: \ 1. A constant diff --git a/fs/tests/comp/c/cc.fs b/fs/tests/comp/c/cc.fs @@ -7,8 +7,8 @@ cc<< tests/comp/c/test2.c retconst 42 #eq variables 82 #eq negate -42 #eq -testend \s bwnot $ffffffd5 #eq +testend \s exprbinops 7 #eq binopand 42 #eq binopor 42 #eq diff --git a/fs/tests/comp/c/test2.c b/fs/tests/comp/c/test2.c @@ -15,3 +15,7 @@ short variables() { } // test unary op and that we don't require whitespace around symbols int negate() {int a=$2a; return -a;} +int bwnot() { + int a='*'; + return ~a; +}