Package: gforth / 0.7.3+dfsg-9

qrnnd-build.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Fix a FTBFS in sdiv_qrnnd() (only executed on s390)
Forwarded: no
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2009-09-05

--- a/engine/support.c
+++ b/engine/support.c
@@ -724,16 +724,21 @@
   DCell res;
 #if defined(sdiv_qrnnd)
   /* #warning "using sdiv_qrnnd" */
-  Cell u1,q,r
+  Cell u1,q,r;
   UCell u0;
   UCell MAYBE_UNUSED lz;
   
-  vm_d2twoCell(u,u0,u1);
-  if (v==0)
+  vm_d2twoCell(num,u0,u1);
+  if (denom==0)
     throw(BALL_DIVZERO);
-  if (u1>=v)
-    throw(BALL_RESULTRANGE);
-  sdiv_qrnnd(q,r,u1,u0,v);
+  sdiv_qrnnd(q,r,u1,u0,denom);
+  if ((u1^denom)<0) {
+    if (q>0)
+      throw(BALL_RESULTRANGE);
+  } else {
+    if (q<0)
+      throw(BALL_RESULTRANGE);
+  }
   vm_twoCell2d(q,r,res);
 #else
   UDCell ures;