From bd35ec7cd96ce54678b330ea27426aa577af84b6 Mon Sep 17 00:00:00 2001
From: Fredrik Noring <noring@nocrew.org>
Date: Sat, 30 Oct 1999 00:02:30 +0200
Subject: [PATCH] Bugfix for push_int64.

Rev: src/bignum.c:1.12
---
 src/bignum.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/bignum.c b/src/bignum.c
index 745732603d..03bc62583b 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -118,10 +118,12 @@ void convert_svalue_to_bignum(struct svalue *s)
   dmalloc_touch_svalue(sp);
 }
 
+#ifdef INT64
+/* These routines can be made much more optimized. */
+
 #define BIGNUM_INT64_MASK  0xffff
 #define BIGNUM_INT64_SHIFT 16
 
-#ifdef INT64
 void push_int64(INT64 i)
 {
   if(i == (INT_TYPE)i)
@@ -158,6 +160,9 @@ void push_int64(INT64 i)
       apply_low(sp[-2].u.object, orfun, 1);
       stack_swap();
       pop_stack();
+
+      if(sp[-1].type == T_INT)
+	convert_stack_top_to_bignum();
     }
     
     if(neg)
@@ -204,7 +209,7 @@ int int64_from_bignum(INT64 *i, struct object *bignum)
 
   if(neg)
     *i = ~*i;
-
+  
   return 1;   /* We may someday return 0 if the conversion fails. */
 }
 #endif /* INT64 */
-- 
GitLab