mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-04 14:30:16 +00:00
Use new 16-bit unsigned multiply routine that complies with C standards.
This changes unsigned 16-bit multiplies to use the new ~CUMul2 routine in ORCALib, rather than ~UMul2 in SysLib. They differ in that ~CUMul2 gives the low-order 16 bits of the true result in case of overflow. The C standards require this behavior for arithmetic on unsigned types.
This commit is contained in:
parent
11a3195c49
commit
497e5c036b
11
Gen.pas
11
Gen.pas
|
@ -6457,12 +6457,13 @@ procedure GenTree {op: icptr};
|
||||||
end {if}
|
end {if}
|
||||||
else
|
else
|
||||||
LoadX(op^.right);
|
LoadX(op^.right);
|
||||||
if op^.opcode = pc_mpi then
|
if op^.opcode = pc_mpi then begin
|
||||||
GenCall(28)
|
GenCall(28);
|
||||||
|
if rangeCheck then
|
||||||
|
GenCall(25);
|
||||||
|
end {if}
|
||||||
else {pc_umi}
|
else {pc_umi}
|
||||||
GenCall(39);
|
GenCall(94);
|
||||||
if rangeCheck then
|
|
||||||
GenCall(25);
|
|
||||||
end; {GenMpi}
|
end; {GenMpi}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2049,6 +2049,7 @@ case callNum of
|
||||||
91: sp := @'~SINGLEPRECISION';
|
91: sp := @'~SINGLEPRECISION';
|
||||||
92: sp := @'~DOUBLEPRECISION';
|
92: sp := @'~DOUBLEPRECISION';
|
||||||
93: sp := @'~COMPPRECISION';
|
93: sp := @'~COMPPRECISION';
|
||||||
|
94: sp := @'~CUMUL2';
|
||||||
otherwise:
|
otherwise:
|
||||||
Error(cge1);
|
Error(cge1);
|
||||||
end; {case}
|
end; {case}
|
||||||
|
|
4
cc.notes
4
cc.notes
|
@ -262,7 +262,7 @@ ORCA/C now supports additional forms of expressions known as generic selection e
|
||||||
|
|
||||||
p. 311
|
p. 311
|
||||||
|
|
||||||
If integer overflow occurs during signed integer multiplication, the resulting value is not predictable. Contrary to what the description in the manual implies, it will not necessarily be the low-order bits from the true product of the operands.
|
If integer overflow occurs during signed integer multiplication, the resulting value is not predictable. Contrary to what the description in the manual implies, it will not necessarily be the low-order bits from the true product of the operands. (Unsigned integer multiplication does give the low-order bits from the true product.)
|
||||||
|
|
||||||
p. 321
|
p. 321
|
||||||
|
|
||||||
|
@ -1861,6 +1861,8 @@ int foo(int[42]);
|
||||||
|
|
||||||
199. If a file is open for reading and writing, it should be possible to read from it until end-of-file is encountered and then immediately write to it, but an error would be reported when the write was attempted.
|
199. If a file is open for reading and writing, it should be possible to read from it until end-of-file is encountered and then immediately write to it, but an error would be reported when the write was attempted.
|
||||||
|
|
||||||
|
200. Arithmetic operations on unsigned integer types should give the low-order bits of the true mathematical result in the event of overflow, but 16-bit unsigned multiplication did not always do this.
|
||||||
|
|
||||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||||
|
|
||||||
1. In some situations, fread() reread the first 1K or so of the file.
|
1. In some situations, fread() reread the first 1K or so of the file.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user