[Python-checkins] r77622 - python/branches/py3k-cdecimal/Modules/cdecimal/basearith.c

stefan.krah python-checkins at python.org
Thu Jan 21 15:47:00 CET 2010


Author: stefan.krah
Date: Thu Jan 21 15:47:00 2010
New Revision: 77622

Log:
Change size_t to mpd_size_t.

Modified:
   python/branches/py3k-cdecimal/Modules/cdecimal/basearith.c

Modified: python/branches/py3k-cdecimal/Modules/cdecimal/basearith.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/cdecimal/basearith.c	(original)
+++ python/branches/py3k-cdecimal/Modules/cdecimal/basearith.c	Thu Jan 21 15:47:00 2010
@@ -28,11 +28,11 @@
  */
 mpd_uint_t
 _mpd_baseadd(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v,
-             size_t m, size_t n)
+             mpd_size_t m, mpd_size_t n)
 {
 	mpd_uint_t s;
 	mpd_uint_t carry = 0;
-	size_t i;
+	mpd_size_t i;
 
 	assert(n > 0 && m >= n);
 
@@ -61,11 +61,11 @@
  * has to make sure that w is big enough.
  */
 void
-_mpd_baseaddto(mpd_uint_t *w, const mpd_uint_t *u, size_t n)
+_mpd_baseaddto(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n)
 {
 	mpd_uint_t s;
 	mpd_uint_t carry = 0;
-	size_t i;
+	mpd_size_t i;
 
 	if (n == 0) return;
 
@@ -88,11 +88,11 @@
  * final carry.
  */
 mpd_uint_t
-_mpd_shortadd(mpd_uint_t *w, size_t m, mpd_uint_t v)
+_mpd_shortadd(mpd_uint_t *w, mpd_size_t m, mpd_uint_t v)
 {
 	mpd_uint_t s;
 	mpd_uint_t carry = 0;
-	size_t i;
+	mpd_size_t i;
 
 	/* add v to u */
 	s = w[0] + v;
@@ -111,11 +111,11 @@
 
 /* Increment u. The calling function has to handle a possible carry. */
 mpd_uint_t
-_mpd_baseincr(mpd_uint_t *u, size_t n)
+_mpd_baseincr(mpd_uint_t *u, mpd_size_t n)
 {
 	mpd_uint_t s;
 	mpd_uint_t carry = 1;
-	size_t i;
+	mpd_size_t i;
 
 	assert(n > 0);
 
@@ -135,11 +135,11 @@
  *     number in u >= number in v;
  */
 void
-_mpd_basesub(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v, size_t m, size_t n)
+_mpd_basesub(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v, mpd_size_t m, mpd_size_t n)
 {
 	mpd_uint_t d;
 	mpd_uint_t borrow = 0;
-	size_t i;
+	mpd_size_t i;
 
 	assert(m > 0 && n > 0);
 
@@ -166,11 +166,11 @@
  * further, but eventually w can absorb the final borrow.
  */
 void
-_mpd_basesubfrom(mpd_uint_t *w, const mpd_uint_t *u, size_t n)
+_mpd_basesubfrom(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n)
 {
 	mpd_uint_t d;
 	mpd_uint_t borrow = 0;
-	size_t i;
+	mpd_size_t i;
 
 	if (n == 0) return;
 
@@ -190,11 +190,11 @@
 
 /* w := product of u (len n) and v (single word) */
 void
-_mpd_shortmul(mpd_uint_t *w, const mpd_uint_t *u, size_t n, mpd_uint_t v)
+_mpd_shortmul(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n, mpd_uint_t v)
 {
 	mpd_uint_t hi, lo;
 	mpd_uint_t carry = 0;
-	size_t i;
+	mpd_size_t i;
 
 	assert(n > 0);
 
@@ -215,11 +215,11 @@
  *     w must be initialized to zero
  */
 void
-_mpd_basemul(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v, size_t m, size_t n)
+_mpd_basemul(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v, mpd_size_t m, mpd_size_t n)
 {
 	mpd_uint_t hi, lo;
 	mpd_uint_t carry;
-	size_t i, j;
+	mpd_size_t i, j;
 
 	assert(m > 0 && n > 0);
 
@@ -244,15 +244,15 @@
  *     w := quotient of u (len n) divided by a single word v
  */
 mpd_uint_t
-_mpd_shortdiv(mpd_uint_t *w, const mpd_uint_t *u, size_t n, mpd_uint_t v)
+_mpd_shortdiv(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n, mpd_uint_t v)
 {
 	mpd_uint_t hi, lo;
 	mpd_uint_t rem = 0;
-	size_t i;
+	mpd_size_t i;
 
 	assert(n > 0);
 
-	for (i=n-1; i != SIZE_MAX; i--) {
+	for (i=n-1; i != MPD_SIZE_MAX; i--) {
 
 		_mpd_mul_words(&hi, &lo, rem, MPD_RADIX);
 		lo = u[i] + lo;
@@ -276,7 +276,7 @@
  */
 int
 _mpd_basedivmod(mpd_uint_t *q, mpd_uint_t *r, const mpd_uint_t *uconst, const mpd_uint_t *vconst,
-                size_t nplusm, size_t n)
+                mpd_size_t nplusm, mpd_size_t n)
 {
 	mpd_uint_t ustatic[MPD_MINALLOC_MAX];
 	mpd_uint_t vstatic[MPD_MINALLOC_MAX];
@@ -285,7 +285,7 @@
 	mpd_uint_t d, qhat, rhat, w2[2];
 	mpd_uint_t hi, lo, x;
 	mpd_uint_t carry;
-	size_t i, j, m;
+	mpd_size_t i, j, m;
 	int retval = 0;
 
 	assert(n > 1 && nplusm >= n);
@@ -311,7 +311,7 @@
 
 	/* D2: loop */
 	rhat = 0;
-	for (j=m; j != SIZE_MAX; j--) {
+	for (j=m; j != MPD_SIZE_MAX; j--) {
 
 		/* D3: calculate qhat and rhat */
 		rhat = _mpd_shortdiv(w2, u+j+n-1, 2, v[n-1]);
@@ -375,7 +375,7 @@
 
 /* Leftshift of src by shift digits; src may equal dest. */
 void
-_mpd_baseshiftl(mpd_uint_t *dest, mpd_uint_t *src, size_t n, size_t m, size_t shift)
+_mpd_baseshiftl(mpd_uint_t *dest, mpd_uint_t *src, mpd_size_t n, mpd_size_t m, mpd_size_t shift)
 {
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
 	/* spurious uninitialized warnings */
@@ -399,7 +399,7 @@
 		if (h != 0) {
 			dest[n--] = h;
 		}
-		for (; m != SIZE_MAX; m--,n--) {
+		for (; m != MPD_SIZE_MAX; m--,n--) {
 			_mpd_divmod_pow10(&h, &l, src[m], MPD_RDIGITS-r);
 			dest[n] = ph * lprev + h;
 			lprev = l;
@@ -407,7 +407,7 @@
 		dest[q] = ph * lprev;
 	}
 	else {
-		while (--m != SIZE_MAX) {
+		while (--m != MPD_SIZE_MAX) {
 			dest[m+q] = src[m];
 		}
 	}
@@ -417,7 +417,7 @@
 
 /* Rightshift of src by shift digits; src may equal dest. */
 mpd_uint_t
-_mpd_baseshiftr(mpd_uint_t *dest, mpd_uint_t *src, size_t slen, size_t shift)
+_mpd_baseshiftr(mpd_uint_t *dest, mpd_uint_t *src, mpd_size_t slen, mpd_size_t shift)
 {
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
 	/* spurious uninitialized warnings */
@@ -427,7 +427,7 @@
 #endif
 	mpd_uint_t rnd, rest;   /* rounding digit, rest */
 	mpd_uint_t q, r;
-	size_t i, j;
+	mpd_size_t i, j;
 	mpd_uint_t ph;
 
 	assert(slen > 0);
@@ -482,11 +482,11 @@
  * final carry.
  */
 mpd_uint_t
-_mpd_shortadd_b(mpd_uint_t *w, size_t m, mpd_uint_t v, mpd_uint_t b)
+_mpd_shortadd_b(mpd_uint_t *w, mpd_size_t m, mpd_uint_t v, mpd_uint_t b)
 {
 	mpd_uint_t s;
 	mpd_uint_t carry = 0;
-	size_t i;
+	mpd_size_t i;
 
 	/* add v to u */
 	s = w[0] + v;
@@ -505,11 +505,11 @@
 
 /* w := product of u (len n) and v (single word) */
 void
-_mpd_shortmul_b(mpd_uint_t *w, const mpd_uint_t *u, size_t n, mpd_uint_t v, mpd_uint_t b)
+_mpd_shortmul_b(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n, mpd_uint_t v, mpd_uint_t b)
 {
 	mpd_uint_t hi, lo;
 	mpd_uint_t carry = 0;
-	size_t i;
+	mpd_size_t i;
 
 	assert(n > 0);
 
@@ -529,15 +529,15 @@
  *     w := quotient of u (len n) divided by a single word v
  */
 mpd_uint_t
-_mpd_shortdiv_b(mpd_uint_t *w, const mpd_uint_t *u, size_t n, mpd_uint_t v, mpd_uint_t b)
+_mpd_shortdiv_b(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n, mpd_uint_t v, mpd_uint_t b)
 {
 	mpd_uint_t hi, lo;
 	mpd_uint_t rem = 0;
-	size_t i;
+	mpd_size_t i;
 
 	assert(n > 0);
 
-	for (i=n-1; i != SIZE_MAX; i--) {
+	for (i=n-1; i != MPD_SIZE_MAX; i--) {
 
 		_mpd_mul_words(&hi, &lo, rem, b);
 		lo = u[i] + lo;


More information about the Python-checkins mailing list