]> www.ginac.de Git - cln.git/blobdiff - src/base/digitseq/cl_DS.h
* src/base/digitseq/cl_asm.h: Test if (intDsize==32) for MIPS and HPPA,
[cln.git] / src / base / digitseq / cl_DS.h
index 7f5e9d1bf5ee047a7d30a4e0e0893e0a2151ea71..61dd161e368953d266d3a9a8d396ee400f5627dd 100644 (file)
@@ -3,12 +3,14 @@
 #ifndef _CL_DS_H
 #define _CL_DS_H
 
-#include "cl_types.h"
+#include "cln/types.h"
 #include "cl_gmpconfig.h"
 #include "cl_D.h"
 #include "cl_DS_endian.h"
 #include "cl_alloca.h"
 
+namespace cln {
+
 // Digit Sequence (DS)
 // a memory range with n digits (n an uintC),
 // between two pointers MSDptr and LSDptr.
@@ -349,7 +351,9 @@ extern void shiftxor_loop_up (uintD* xptr, const uintD* yptr, uintC count, uintC
 // Supersede the functions by wrappers around calls to gmp mpn,
 // for those functions where gmp is believed to be faster.
 
+extern "C" {
 #include <gmp.h>
+}
 
 #if 0 // not worth it, since gmp's mpn_cmp is not optimized
 inline cl_signean compare_loop_down (const uintD* xptr, const uintD* yptr, uintC count)
@@ -516,6 +520,28 @@ inline uintD mulusub_loop_up (uintD digit, const uintD* sourceptr, uintD* destpt
 
 #define MUL_LOOPS
 
+inline uintD divu_loop_up (uintD digit, uintD* ptr, uintC len)
+{
+       return mpn_divrem_1(ptr,0,ptr,len,digit);
+}
+
+inline uintD divu_loop_down (uintD digit, uintD* ptr, uintC len)
+{
+       return mpn_divrem_1(ptr-len,0,ptr-len,len,digit);
+}
+
+inline uintD divucopy_loop_up (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len)
+{
+       return mpn_divrem_1(destptr,0,sourceptr,len,digit);
+}
+
+inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len)
+{
+       return mpn_divrem_1(destptr-len,0,sourceptr-len,len,digit);
+}
+
+#define DIV_LOOPS
+
 #endif // defined(CL_USE_GMP)
 
 
@@ -2649,5 +2675,6 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len,
   extern void cl_UDS_recipsqrt (const uintD* a_MSDptr, uintC a_len,
                                 uintD* b_MSDptr, uintC b_len);
 
+}  // namespace cln
 
 #endif /* _CL_DS_H */