diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index 51d24870..719ec5e7 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -761,15 +761,27 @@ (list (lambda (f g ta t d) (i386:accu-base))))))) - ((lshift ,a (p-expr (fixed ,value))) + ((bitwise-or ,a ,b) (let* ((empty (clone info #:text '())) (accu ((expr->accu empty) a)) - (value (cstring->number value))) + (base ((expr->base empty) b))) (clone info #:text (append text (.text accu) + (.text base) (list (lambda (f g ta t d) - (i386:accu-shl value))))))) + (i386:accu-or-base))))))) + + ((lshift ,a ,b) + (let* ((empty (clone info #:text '())) + (accu ((expr->accu empty) a)) + (base ((expr->base empty) b))) + (clone info #:text + (append text + (.text accu) + (.text base) + (list (lambda (f g ta t d) + (i386:accu<accu i386:base->accu-address diff --git a/scaffold/t.c b/scaffold/t.c index cffa2ce7..419e7533 100644 --- a/scaffold/t.c +++ b/scaffold/t.c @@ -212,6 +212,13 @@ math_test () puts ("t: 3*4="); i = 3 * 4; if (i!=12) return 1; + + puts ("t: 1 << 3\n"); + if (1 << 3 != 8) return 1 << 3; + + puts ("t: 3 << 4\n"); + if (3 << 4 != 48) return 3 << 4; + return read_test (); }