[libmath-prime-util-perl] 06/11: Split out bitarray and type header files

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:44:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.03
in repository libmath-prime-util-perl.

commit f761e564b6c086ed68d5b7d6086239f04c126526
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed Jun 6 10:18:07 2012 -0600

    Split out bitarray and type header files
---
 MANIFEST   |  1 +
 XS.xs      |  1 +
 bitarray.h | 40 +---------------------------------------
 factor.c   |  2 +-
 factor.h   |  4 +---
 sieve.c    |  1 +
 util.c     |  2 +-
 util.h     |  5 ++---
 8 files changed, 9 insertions(+), 47 deletions(-)

diff --git a/MANIFEST b/MANIFEST
index 3c724f3..ecb1096 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -7,6 +7,7 @@ README
 TODO
 XS.xs
 bitarray.h
+ptypes.h
 factor.h
 factor.c
 sieve.h
diff --git a/XS.xs b/XS.xs
index fbeb66a..7027934 100644
--- a/XS.xs
+++ b/XS.xs
@@ -3,6 +3,7 @@
 #include "perl.h"
 #include "XSUB.h"
 /* We're not using anything for which we need ppport.h */
+#include "ptypes.h"
 #include "sieve.h"
 #include "util.h"
 #include "bitarray.h"
diff --git a/bitarray.h b/bitarray.h
index a076296..ff117b6 100644
--- a/bitarray.h
+++ b/bitarray.h
@@ -1,45 +1,7 @@
 #ifndef MPU_BITARRAY_H
 #define MPU_BITARRAY_H
 
-#include "EXTERN.h"
-#include "perl.h"
-
-/* From perl.h, wrapped in PERL_CORE */
-#ifndef U32_CONST
-# if INTSIZE >= 4
-#  define U32_CONST(x) ((U32TYPE)x##U)
-# else
-#  define U32_CONST(x) ((U32TYPE)x##UL)
-# endif
-#endif
-
-/* From perl.h, wrapped in PERL_CORE */
-#ifndef U64_CONST
-# ifdef HAS_QUAD
-#  if INTSIZE >= 8
-#   define U64_CONST(x) ((U64TYPE)x##U)
-#  elif LONGSIZE >= 8
-#   define U64_CONST(x) ((U64TYPE)x##UL)
-#  elif QUADKIND == QUAD_IS_LONG_LONG
-#   define U64_CONST(x) ((U64TYPE)x##ULL)
-#  else /* best guess we can make */
-#   define U64_CONST(x) ((U64TYPE)x##UL)
-#  endif
-# endif
-#endif
-
-
-#ifdef HAS_QUAD
-  #define BITS_PER_WORD  64
-  #define UVCONST(x)     U64_CONST(x)
-#else
-  #define BITS_PER_WORD  32
-  #define UVCONST(x)     U32_CONST(x)
-#endif
-
-#define MAXBIT        (BITS_PER_WORD-1)
-#define NWORDS(bits)  ( ((bits)+BITS_PER_WORD-1) / BITS_PER_WORD )
-#define NBYTES(bits)  ( ((bits)+8-1) / 8 )
+#include "ptypes.h"
 
 /* The mod-30 wheel is byte-based so doesn't use these. */
 #define SET_ARRAY_BIT(ar,n) \
diff --git a/factor.c b/factor.c
index 7497f8a..546123e 100644
--- a/factor.c
+++ b/factor.c
@@ -8,7 +8,7 @@
 #include "factor.h"
 #include "util.h"
 #include "sieve.h"
-#include "bitarray.h"
+#include "ptypes.h"
 
 /*
  * You need to remember to use UV for unsigned and IV for signed types that
diff --git a/factor.h b/factor.h
index 3659833..6c995e7 100644
--- a/factor.h
+++ b/factor.h
@@ -1,8 +1,7 @@
 #ifndef MPU_FACTOR_H
 #define MPU_FACTOR_H
 
-#include "EXTERN.h"
-#include "perl.h"
+#include "ptypes.h"
 
 #define MPU_MAX_FACTORS 64
 
@@ -22,7 +21,6 @@ extern int miller_rabin(UV n, const UV *bases, UV nbases);
 extern int is_prob_prime(UV n);
 
 #if 0
-#include "bitarray.h"
 /* Try to make a quick probable prime test */
 static int is_perhaps_prime(UV n)
 {
diff --git a/sieve.c b/sieve.c
index adb8ead..0598c9a 100644
--- a/sieve.c
+++ b/sieve.c
@@ -6,6 +6,7 @@
 #include <math.h>
 
 #include "sieve.h"
+#include "ptypes.h"
 #include "bitarray.h"
 #include "util.h"     /* For freeing the segment cache */
 
diff --git a/util.c b/util.c
index aa5e545..95c0a00 100644
--- a/util.c
+++ b/util.c
@@ -8,7 +8,7 @@
 #include "util.h"
 #include "sieve.h"
 #include "factor.h"
-#include "bitarray.h"
+#include "ptypes.h"
 
 /*
  * I'm undecided as to whether we want this, or just let the functions alloc
diff --git a/util.h b/util.h
index 35659d0..1a89605 100644
--- a/util.h
+++ b/util.h
@@ -1,8 +1,7 @@
 #ifndef MPU_UTIL_H
 #define MPU_UTIL_H
 
-#include "EXTERN.h"
-#include "perl.h"
+#include "ptypes.h"
 
 extern int is_prime(UV x);
 extern UV  next_trial_prime(UV x);
@@ -19,7 +18,7 @@ extern UV  nth_prime_upper(UV x);
 extern UV  nth_prime_approx(UV x);
 extern UV  nth_prime(UV x);
 
-#define SEGMENT_CHUNK_SIZE 262144
+#define SEGMENT_CHUNK_SIZE  UVCONST(262144)
 extern unsigned char* get_prime_segment(void);
 extern void           free_prime_segment(void);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list