[gap] Update -stat patch to provide large integer conversion (for, e.g., loff_t). Drop meataxe Requirement

Jerry James jjames at fedoraproject.org
Wed May 22 17:52:28 UTC 2013


commit 78c81780341c50d2ccda75672b365af6600e3d63
Author: Jerry James <jamesjer at betterlinux.com>
Date:   Wed May 22 11:51:28 2013 -0600

    Update -stat patch to provide large integer conversion (for, e.g., loff_t).
    Drop meataxe Requirement as it has been replaced with internal routines.

 gap-stat.patch |  152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gap.spec       |    7 ++-
 2 files changed, 157 insertions(+), 2 deletions(-)
---
diff --git a/gap-stat.patch b/gap-stat.patch
index 7abf3aa..b311d1c 100644
--- a/gap-stat.patch
+++ b/gap-stat.patch
@@ -1,3 +1,155 @@
+--- ./src/integer.h.orig	2013-05-04 10:45:21.000000000 -0600
++++ ./src/integer.h	2013-05-22 11:18:27.468094940 -0600
+@@ -59,6 +59,20 @@ Obj ObjInt_Int(Int i);
+ Obj ObjInt_UInt(UInt i);
+ 
+ 
++/**************************************************************************
++** The following two functions convert a C long long or unsigned long long
++** respectively into a GAP integer, either an immediate, small integer if
++** possible or otherwise a new GAP bag with TNUM T_INTPOS or T_INTNEG.
++**
++*F ObjInt_LongLong(long long i)
++*F ObjInt_ULongLong(unsigned long long i)
++**
++****************************************************************************/
++
++Obj ObjInt_LongLong(long long i);
++Obj ObjInt_ULongLong(unsigned long long i);
++
++
+ /****************************************************************************
+ **
+ *F  PrintInt( <int> ) . . . . . . . . . . . . . . . print an integer constant
+--- ./src/integer.c.orig	2013-05-04 10:45:21.000000000 -0600
++++ ./src/integer.c	2013-05-22 11:32:58.815893606 -0600
+@@ -237,6 +237,58 @@ Obj ObjInt_UInt(UInt i)
+ }
+ 
+ 
++/**************************************************************************
++** The following two functions convert a C long long or unsigned long long
++** respectively into a GAP integer, either an immediate, small integer if
++** possible or otherwise a new GAP bag with TNUM T_INTPOS or T_INTNEG.
++**
++*F ObjInt_LongLong(long long i)
++*F ObjInt_ULongLong(unsigned long long i)
++**
++****************************************************************************/
++
++#define NDIGITS_RAW (sizeof (long long) / sizeof (TypDigit))
++#define NDIGITS (NDIGITS_RAW >= 4U ? NDIGITS_RAW : 4U)
++
++Obj ObjInt_LongLong(long long i)
++{
++    Obj n;
++    long long bound = 1LL << NR_SMALL_INT_BITS;
++    if (i >= bound) {
++        /* We have to make a big integer */
++        size_t j;
++        n = NewBag(T_INTPOS, NDIGITS);
++        for ( j = 0U; j < NDIGITS; j++ )
++            ADDR_INT(n)[j] = (TypDigit) (i >> (j * NR_DIGIT_BITS));
++        return n;
++    } else if (-i > bound) {
++        size_t j;
++        n = NewBag(T_INTNEG, NDIGITS);
++        for ( j = 0U; j < NDIGITS; j++ )
++            ADDR_INT(n)[j] = (TypDigit) ((-i) >> (j * NR_DIGIT_BITS));
++        return n;
++    } else {
++        return INTOBJ_INT((Int) i);
++    }
++}
++
++Obj ObjInt_ULongLong(unsigned long long i)
++{
++    Obj n;
++    unsigned long long bound = 1ULL << NR_SMALL_INT_BITS;
++    if (i >= bound) {
++        /* We have to make a big integer */
++        size_t j;
++        n = NewBag(T_INTPOS, NDIGITS);
++        for ( j = 0U; j < NDIGITS; j++ )
++            ADDR_INT(n)[j] = (TypDigit) (i >> (j * NR_DIGIT_BITS));
++        return n;
++    } else {
++        return INTOBJ_INT((Int) i);
++    }
++}
++
++
+ 
+ /****************************************************************************
+ **
+--- ./src/gmpints.h.orig	2013-05-04 10:45:21.000000000 -0600
++++ ./src/gmpints.h	2013-05-22 11:18:27.469094938 -0600
+@@ -79,6 +79,21 @@ typedef UInt2           TypDigit;
+ Obj ObjInt_Int(Int i);
+ Obj ObjInt_UInt(UInt i);
+ 
++
++/**************************************************************************
++** The following two functions convert a C long long or unsigned long long
++** respectively into* a GAP integer, either an immediate, small integer if
++** possible or otherwise a new GAP bag with TNUM T_INTPOS or T_INTNEG.
++**
++*F ObjInt_LongLong(long long i)
++*F ObjInt_ULongLong(unsigned long long i)
++**
++****************************************************************************/
++
++Obj ObjInt_LongLong(long long i);
++Obj ObjInt_ULongLong(unsigned long long i);
++
++
+ /****************************************************************************
+ **
+ */
+--- ./src/gmpints.c.orig	2013-05-04 10:45:21.000000000 -0600
++++ ./src/gmpints.c	2013-05-22 11:19:35.728935667 -0600
+@@ -358,6 +358,41 @@ Obj ObjInt_UInt( UInt i )
+   }
+ }
+ 
++Obj ObjInt_LongLong( long long i )
++{
++  Obj gmp;
++  unsigned long long ull;
++  size_t j;
++
++  if ( (-(1LL<<NR_SMALL_INT_BITS) <= i) && (i < 1LL<<NR_SMALL_INT_BITS ))
++    return INTOBJ_INT((Int) i);
++
++  if ( i >= 0LL ) {
++    gmp = NewBag( T_INTPOS, sizeof(i) );
++    ull = (unsigned long long) i;
++  }
++  else {
++    gmp = NewBag( T_INTNEG, sizeof(i) );
++    ull = (unsigned long long) -i;
++  }
++  for ( j = 0U; j < sizeof(i) / sizeof(TypLimb); j++ )
++    ((TypLimb *)ADDR_OBJ( gmp ))[j] = ull >> (j * sizeof(TypLimb));
++  return GMP_NORMALIZE( gmp );
++}
++
++Obj ObjInt_ULongLong( unsigned long long i )
++{
++  Obj gmp;
++  size_t j;
++
++  if ( i < 1ULL<<NR_SMALL_INT_BITS )
++    return INTOBJ_INT((Int) i);
++  gmp = NewBag( T_INTPOS, sizeof(i) );
++  for ( j = 0U; j < sizeof(i) / sizeof(TypLimb); j++ )
++    ((TypLimb *)ADDR_OBJ( gmp ))[j] = i >> (j * sizeof(TypLimb));
++  return GMP_NORMALIZE( gmp );
++}
++
+ 
+ /****************************************************************************
+ **
 --- ./src/streams.c.orig	2013-02-01 18:09:31.000000000 -0700
 +++ ./src/streams.c	2013-02-20 09:32:40.123439294 -0700
 @@ -2134,13 +2134,13 @@ Obj FuncREAD_STRING_FILE (
diff --git a/gap.spec b/gap.spec
index f37a9c9..de75284 100644
--- a/gap.spec
+++ b/gap.spec
@@ -6,7 +6,7 @@
 
 Name:           gap
 Version:        %(sed -r "s/r|p/./g" <<<%upstreamver)
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Computational discrete algebra
 
 Group:          Applications/Engineering
@@ -48,7 +48,6 @@ BuildRequires:  xemacs
 Requires:       %{name}-libs = %{version}-%{release}
 Requires:       %{name}-core%{?_isa} = %{version}-%{release}
 Requires:       %{name}-online-help = %{version}-%{release}
-Requires:       meataxe
 
 %description
 GAP is a system for computational discrete algebra, with particular
@@ -398,6 +397,10 @@ make testinstall
 %{_xemacs_sitelispdir}/gap*.el
 
 %changelog
+* Wed May 22 2013 Jerry James <loganjerry at gmail.com> - 4.6.4-2
+- Update -stat patch to provide large integer conversion (for, e.g., loff_t)
+- Drop meataxe Requirement as it has been replaced with internal routines
+
 * Thu May 16 2013 Jerry James <loganjerry at gmail.com> - 4.6.4-1
 - New upstream release
 


More information about the scm-commits mailing list