Blob Blame Raw
--- src/integer.c.orig	2019-02-23 15:43:33.000000000 -0700
+++ src/integer.c	2019-03-12 13:39:47.357775303 -0600
@@ -567,6 +567,41 @@ Obj ObjInt_UInt8( UInt8 i )
 #endif
 }
 
+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(mp_limb_t); j++ )
+    ((mp_limb_t *)ADDR_OBJ( gmp ))[j] = ull >> (j * sizeof(mp_limb_t));
+  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(mp_limb_t); j++ )
+    ((mp_limb_t *)ADDR_OBJ( gmp ))[j] = i >> (j * sizeof(mp_limb_t));
+  return GMP_NORMALIZE( gmp );
+}
+
 /**************************************************************************
 **
 ** Convert GAP Integers to various C types -- see header file
--- src/integer.h.orig	2019-02-23 15:43:33.000000000 -0700
+++ src/integer.h	2019-03-12 13:39:47.358775285 -0600
@@ -135,6 +135,8 @@ extern Obj ObjInt_Int(Int i);
 extern Obj ObjInt_UInt(UInt i);
 extern Obj ObjInt_Int8(Int8 i);
 extern Obj ObjInt_UInt8(UInt8 i);
+extern Obj ObjInt_LongLong(long long i);
+extern Obj ObjInt_ULongLong(unsigned long long i);
 
 /**************************************************************************
 **