mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-22 07:30:54 +00:00
Allow unsigned long values greater than 2^31 to be used as the second operand to % in constant expressions.
The following is an example that would give a compile error before this patch: int main(void) { unsigned long i = 1 % 3000000000; } The remainder operation still does not work properly for signed types when either operand is negative. It gives either errors or incorrect values in various cases, both when evaluated at compile time and run time. Fully addressing this (including the run-time cases) would require library updates.
This commit is contained in:
parent
f4ad0fab80
commit
b6b2121a9e
@ -1100,10 +1100,11 @@ var
|
||||
op1 := op1 div op2;
|
||||
end;
|
||||
percentch : begin {%}
|
||||
if op2 <= 0 then begin
|
||||
Error(109);
|
||||
op2 := 1;
|
||||
end; {if}
|
||||
if op2 <= 0 then {FIXME: support negative values}
|
||||
if (op2 = 0) or (not unsigned) then begin
|
||||
Error(109);
|
||||
op2 := 1;
|
||||
end; {if}
|
||||
if unsigned then
|
||||
op1 := umod(op1,op2)
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user