no overflow in OPM anymore

Former-commit-id: 05b8d63835
This commit is contained in:
Norayr Chilingarian 2014-09-17 15:21:33 +04:00
parent 4210848dfd
commit 4a32c7d5c1
3 changed files with 15 additions and 7 deletions

View file

@ -564,8 +564,15 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
END END
END GetProperty; END GetProperty;
PROCEDURE power0(i, j : INTEGER) : LONGINT; (* we would like to calculate exact Min Max values in GetProperties, not hardcode em, noch *)
VAR k : INTEGER;
PROCEDURE minus(i: LONGINT): LONGINT;
BEGIN
RETURN -i;
END minus;
PROCEDURE power0(i, j : LONGINT) : LONGINT; (* we would like to calculate exact Min Max values in GetProperties, not hardcode em, noch *)
VAR k : LONGINT;
p : LONGINT; p : LONGINT;
BEGIN BEGIN
k := 1; k := 1;
@ -674,11 +681,12 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
MinSInt := power0(-2, (SIntSize*8-1)); (* -2^(SIntSize*8-1)*) MinSInt := power0(-2, (SIntSize*8-1)); (* -2^(SIntSize*8-1)*)
MaxSInt := power0(2, (SIntSize*8-1))-1; (*MaxSInt := -(MinSint + 1);; may be optimized?*)
MaxSInt := minus(MinSInt + 1);
MinInt := power0(-2, (IntSize*8-1)); MinInt := power0(-2, (IntSize*8-1));
MaxInt := power0(2, (IntSize*8-1))-1; MaxInt := minus(MinInt + 1);
MinLInt := power0(-2, (LIntSize*8-1)); MinLInt := power0(-2, (LIntSize*8-1));
MaxLInt := power0(2, (LIntSize*8-1))-1; MaxLInt := minus(MinLInt +1);
(* (*
Console.Int(MinSInt, 0); Console.Ln; Console.Int(MinSInt, 0); Console.Ln;

View file

@ -1 +1 @@
ddb127a2e317296bc2e9e45f089e5a938c5e7bed 90416871552aca31fdc4f4df787d5ad56448ca5d

View file

@ -1 +1 @@
3326a0fc447824a7e2a6d9b35c79b178bfe7ea61 90416871552aca31fdc4f4df787d5ad56448ca5d