ports/lang/ficl/files/patch-double.c
Raphael Kubo da Costa 26372dce2a Bring in some fixes from GSoC 2015.
There was a GSoC 2015 from Colin Lord to bring to the base system a recent
version of Ficl. pfg@ found many bugs in ficl4.

Among them:
- Fix ficlInstructionPick bug. Pick instructions from 0, not 1.
Credit to Toomas Soome from the Illumos project.
- Fix some math bugs.
Credit to Toomas Soome from the Illumos project.
- Fix bug in Ficl stack preventing the stack from growing.
Obtained from:    http://sourceforge.net/p/ficl/mailman/message/26634755/
- Change rand and srand calls to random and srandom

Fix those in the port. While here, unset MAKE_JOBS_UNSAFE as the port builds
fine without it, and get rid of the DATA option that has no effect.

PR:		207041
Submitted by:	pfg
Approved by:	Pavel Volkov <pavelivolkov@gmail.com> (maintainer)
2016-03-05 19:07:33 +00:00

29 lines
735 B
C

--- double.c.orig 2010-09-12 15:18:07 UTC
+++ double.c
@@ -157,7 +157,7 @@ ficl2Integer ficl2IntegerMultiply(ficlIn
ficl2Integer ficl2IntegerDecrement(ficl2Integer x)
{
- if (x.low == INT_MIN)
+ if (x.low == INTMAX_MIN)
x.high--;
x.low--;
@@ -168,16 +168,11 @@ ficl2Integer ficl2IntegerDecrement(ficl2
ficl2Unsigned ficl2UnsignedAdd(ficl2Unsigned x, ficl2Unsigned y)
{
ficl2Unsigned result;
- int carry;
result.high = x.high + y.high;
result.low = x.low + y.low;
-
- carry = ((x.low | y.low) & FICL_CELL_HIGH_BIT) && !(result.low & FICL_CELL_HIGH_BIT);
- carry |= ((x.low & y.low) & FICL_CELL_HIGH_BIT);
-
- if (carry)
+ if (result.low < y.low)
{
result.high++;
}