From 3b01699f86d9181d491073c5e825994dbb68a317 Mon Sep 17 00:00:00 2001 From: Massimo Melina Date: Wed, 13 May 2020 11:03:13 +0200 Subject: [PATCH] bit shifting operators [ and ] for {.calc.} --- utillib.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utillib.pas b/utillib.pas index 6136077..b481ca2 100644 --- a/utillib.pas +++ b/utillib.pas @@ -2525,7 +2525,7 @@ begin ch:=s[i]; v:=0; case ch of - '*','/','%': v:=5+ofsImp; + '*','/','%','[',']': v:=5+ofsImp; '+','-': v:=3+ofsImp; '(': inc(ofsImp, PAR_VAL); ')': dec(ofsImp, PAR_VAL); @@ -2562,6 +2562,8 @@ begin '%': if right <> 0 then result:=trunc(left) mod trunc(right) else raise Exception.create('division by zero'); + '[': result:=round(left) shl round(right); + ']': result:=round(left) shr round(right); else raise Exception.create('operator not supported: '+ch); end; // replace sub-expression with result