summaryrefslogtreecommitdiff
path: root/ext/bcmath
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2002-11-20 20:03:01 +0000
committerAndi Gutmans <andi@php.net>2002-11-20 20:03:01 +0000
commitb0528dbe5eb79d2aafad5b368fa5481fe2c3c0c1 (patch)
treec6c058036addc9a8d2aa5750fc86f3e45ca0b4ec /ext/bcmath
parente6b7ab9db86710ca0c90d320bd43dcd4c2c06ed4 (diff)
downloadphp-git-b0528dbe5eb79d2aafad5b368fa5481fe2c3c0c1.tar.gz
- Revert previous patch
Diffstat (limited to 'ext/bcmath')
-rw-r--r--ext/bcmath/bcmath.c14
-rw-r--r--ext/bcmath/libbcmath/src/bcmath.h8
-rw-r--r--ext/bcmath/libbcmath/src/init.c18
-rw-r--r--ext/bcmath/libbcmath/src/output.c4
-rw-r--r--ext/bcmath/libbcmath/src/raise.c4
-rw-r--r--ext/bcmath/libbcmath/src/raisemod.c6
-rw-r--r--ext/bcmath/libbcmath/src/recmul.c10
-rw-r--r--ext/bcmath/libbcmath/src/sqrt.c12
-rw-r--r--ext/bcmath/libbcmath/src/str2num.c2
-rw-r--r--ext/bcmath/libbcmath/src/zero.c2
10 files changed, 40 insertions, 40 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index 894cde7444..2d0e67c4ac 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -65,9 +65,9 @@ static long bc_precision;
#endif
/* Storage used for special numbers. */
-extern bc_num BCG(_zero_);
-extern bc_num BCG(_one_);
-extern bc_num BCG(_two_);
+extern bc_num _zero_;
+extern bc_num _one_;
+extern bc_num _two_;
/* Make a copy of a number! Just increments the reference count! */
@@ -81,15 +81,15 @@ bc_num copy_num (bc_num num)
/* Initialize a number NUM by making it a copy of zero. */
void init_num (bc_num *num)
{
- *num = copy_num (BCG(_zero_));
+ *num = copy_num (_zero_);
}
PHP_RSHUTDOWN_FUNCTION(bcmath)
{
- bc_free_num(&BCG(_zero_));
- bc_free_num(&BCG(_one_));
- bc_free_num(&BCG(_two_));
+ bc_free_num(&_zero_);
+ bc_free_num(&_one_);
+ bc_free_num(&_two_);
return SUCCESS;
}
diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h
index 9fe981466c..a6c7627b6b 100644
--- a/ext/bcmath/libbcmath/src/bcmath.h
+++ b/ext/bcmath/libbcmath/src/bcmath.h
@@ -80,11 +80,11 @@ typedef struct bc_struct
#define LONG_MAX 0x7ffffff
#endif
-#define BCG(s) s##a
+
/* Global numbers. */
-extern bc_num BCG(_zero_);
-extern bc_num BCG(_one_);
-extern bc_num BCG(_two_);
+extern bc_num _zero_;
+extern bc_num _one_;
+extern bc_num _two_;
/* Function Prototypes */
diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c
index a1546214ec..4ff00b1102 100644
--- a/ext/bcmath/libbcmath/src/init.c
+++ b/ext/bcmath/libbcmath/src/init.c
@@ -39,9 +39,9 @@
#include "private.h"
/* Storage used for special numbers. */
-bc_num BCG(_zero_);
-bc_num BCG(_one_);
-bc_num BCG(_two_);
+bc_num _zero_;
+bc_num _one_;
+bc_num _two_;
bc_num _bc_Free_list = NULL;
@@ -105,11 +105,11 @@ bc_free_num (num)
void
bc_init_numbers ()
{
- BCG(_zero_) = bc_new_num (1,0);
- BCG(_one_) = bc_new_num (1,0);
- BCG(_one_)->n_value[0] = 1;
- BCG(_two_) = bc_new_num (1,0);
- BCG(_two_)->n_value[0] = 2;
+ _zero_ = bc_new_num (1,0);
+ _one_ = bc_new_num (1,0);
+ _one_->n_value[0] = 1;
+ _two_ = bc_new_num (1,0);
+ _two_->n_value[0] = 2;
}
@@ -130,6 +130,6 @@ void
bc_init_num (num)
bc_num *num;
{
- *num = bc_copy_num (BCG(_zero_));
+ *num = bc_copy_num (_zero_);
}
diff --git a/ext/bcmath/libbcmath/src/output.c b/ext/bcmath/libbcmath/src/output.c
index 81bcc9afa0..e41479d2d3 100644
--- a/ext/bcmath/libbcmath/src/output.c
+++ b/ext/bcmath/libbcmath/src/output.c
@@ -138,7 +138,7 @@ bc_out_num (num, o_base, out_char, leading_zero)
/* The number is some other base. */
digits = NULL;
bc_init_num (&int_part);
- bc_divide (num, BCG(_one_), &int_part, 0);
+ bc_divide (num, _one_, &int_part, 0);
bc_init_num (&frac_part);
bc_init_num (&cur_dig);
bc_init_num (&base);
@@ -185,7 +185,7 @@ bc_out_num (num, o_base, out_char, leading_zero)
{
(*out_char) ('.');
pre_space = 0;
- t_num = bc_copy_num (BCG(_one_));
+ t_num = bc_copy_num (_one_);
while (t_num->n_len <= num->n_scale) {
bc_multiply (frac_part, base, &frac_part, num->n_scale);
fdigit = bc_num2long (frac_part);
diff --git a/ext/bcmath/libbcmath/src/raise.c b/ext/bcmath/libbcmath/src/raise.c
index b259e22882..5f2f03c208 100644
--- a/ext/bcmath/libbcmath/src/raise.c
+++ b/ext/bcmath/libbcmath/src/raise.c
@@ -66,7 +66,7 @@ bc_raise (num1, num2, result, scale)
if (exponent == 0)
{
bc_free_num (result);
- *result = bc_copy_num (BCG(_one_));
+ *result = bc_copy_num (_one_);
return;
}
@@ -111,7 +111,7 @@ bc_raise (num1, num2, result, scale)
/* Assign the value. */
if (neg)
{
- bc_divide (BCG(_one_), temp, result, rscale);
+ bc_divide (_one_, temp, result, rscale);
bc_free_num (&temp);
}
else
diff --git a/ext/bcmath/libbcmath/src/raisemod.c b/ext/bcmath/libbcmath/src/raisemod.c
index 1b90a9e4ef..cc9dd35a57 100644
--- a/ext/bcmath/libbcmath/src/raisemod.c
+++ b/ext/bcmath/libbcmath/src/raisemod.c
@@ -57,7 +57,7 @@ bc_raisemod (base, expo, mod, result, scale)
/* Set initial values. */
power = bc_copy_num (base);
exponent = bc_copy_num (expo);
- temp = bc_copy_num (BCG(_one_));
+ temp = bc_copy_num (_one_);
bc_init_num(&parity);
/* Check the base for scale digits. */
@@ -68,7 +68,7 @@ bc_raisemod (base, expo, mod, result, scale)
if (exponent->n_scale != 0)
{
bc_rt_warn ("non-zero scale in exponent");
- bc_divide (exponent, BCG(_one_), &exponent, 0); /*truncate */
+ bc_divide (exponent, _one_, &exponent, 0); /*truncate */
}
/* Check the modulus for scale digits. */
@@ -79,7 +79,7 @@ bc_raisemod (base, expo, mod, result, scale)
rscale = MAX(scale, base->n_scale);
while ( !bc_is_zero(exponent) )
{
- (void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0);
+ (void) bc_divmod (exponent, _two_, &exponent, &parity, 0);
if ( !bc_is_zero(parity) )
{
bc_multiply (temp, power, &temp, rscale);
diff --git a/ext/bcmath/libbcmath/src/recmul.c b/ext/bcmath/libbcmath/src/recmul.c
index ec3ff779e5..73f67af574 100644
--- a/ext/bcmath/libbcmath/src/recmul.c
+++ b/ext/bcmath/libbcmath/src/recmul.c
@@ -197,14 +197,14 @@ _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod,
/* Split u and v. */
if (ulen < n) {
- u1 = bc_copy_num (BCG(_zero_));
+ u1 = bc_copy_num (_zero_);
u0 = new_sub_num (ulen,0, u->n_value);
} else {
u1 = new_sub_num (ulen-n, 0, u->n_value);
u0 = new_sub_num (n, 0, u->n_value+ulen-n);
}
if (vlen < n) {
- v1 = bc_copy_num (BCG(_zero_));
+ v1 = bc_copy_num (_zero_);
v0 = new_sub_num (vlen,0, v->n_value);
} else {
v1 = new_sub_num (vlen-n, 0, v->n_value);
@@ -231,17 +231,17 @@ _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod,
/* Do recursive multiplies and shifted adds. */
if (m1zero)
- m1 = bc_copy_num (BCG(_zero_));
+ m1 = bc_copy_num (_zero_);
else
_bc_rec_mul (u1, u1->n_len, v1, v1->n_len, &m1, 0);
if (bc_is_zero(d1) || bc_is_zero(d2))
- m2 = bc_copy_num (BCG(_zero_));
+ m2 = bc_copy_num (_zero_);
else
_bc_rec_mul (d1, d1len, d2, d2len, &m2, 0);
if (bc_is_zero(u0) || bc_is_zero(v0))
- m3 = bc_copy_num (BCG(_zero_));
+ m3 = bc_copy_num (_zero_);
else
_bc_rec_mul (u0, u0->n_len, v0, v0->n_len, &m3, 0);
diff --git a/ext/bcmath/libbcmath/src/sqrt.c b/ext/bcmath/libbcmath/src/sqrt.c
index d4f430906d..34b95b8898 100644
--- a/ext/bcmath/libbcmath/src/sqrt.c
+++ b/ext/bcmath/libbcmath/src/sqrt.c
@@ -51,7 +51,7 @@ bc_sqrt (num, scale)
bc_num guess, guess1, point5, diff;
/* Initial checks. */
- cmp_res = bc_compare (*num, BCG(_zero_));
+ cmp_res = bc_compare (*num, _zero_);
if (cmp_res < 0)
return 0; /* error */
else
@@ -59,15 +59,15 @@ bc_sqrt (num, scale)
if (cmp_res == 0)
{
bc_free_num (num);
- *num = bc_copy_num (BCG(_zero_));
+ *num = bc_copy_num (_zero_);
return 1;
}
}
- cmp_res = bc_compare (*num, BCG(_one_));
+ cmp_res = bc_compare (*num, _one_);
if (cmp_res == 0)
{
bc_free_num (num);
- *num = bc_copy_num (BCG(_one_));
+ *num = bc_copy_num (_one_);
return 1;
}
@@ -84,7 +84,7 @@ bc_sqrt (num, scale)
if (cmp_res < 0)
{
/* The number is between 0 and 1. Guess should start at 1. */
- guess = bc_copy_num (BCG(_one_));
+ guess = bc_copy_num (_one_);
cscale = (*num)->n_scale;
}
else
@@ -121,7 +121,7 @@ bc_sqrt (num, scale)
/* Assign the number and clean up. */
bc_free_num (num);
- bc_divide (guess,BCG(_one_),num,rscale);
+ bc_divide (guess,_one_,num,rscale);
bc_free_num (&guess);
bc_free_num (&guess1);
bc_free_num (&point5);
diff --git a/ext/bcmath/libbcmath/src/str2num.c b/ext/bcmath/libbcmath/src/str2num.c
index 25583d187c..210a7d89ea 100644
--- a/ext/bcmath/libbcmath/src/str2num.c
+++ b/ext/bcmath/libbcmath/src/str2num.c
@@ -65,7 +65,7 @@ bc_str2num (num, str, scale)
while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
if ((*ptr != '\0') || (digits+strscale == 0))
{
- *num = bc_copy_num (BCG(_zero_));
+ *num = bc_copy_num (_zero_);
return;
}
diff --git a/ext/bcmath/libbcmath/src/zero.c b/ext/bcmath/libbcmath/src/zero.c
index e21bb29252..dce77ba4aa 100644
--- a/ext/bcmath/libbcmath/src/zero.c
+++ b/ext/bcmath/libbcmath/src/zero.c
@@ -48,7 +48,7 @@ bc_is_zero (num)
char *nptr;
/* Quick check. */
- if (num == BCG(_zero_)) return TRUE;
+ if (num == _zero_) return TRUE;
/* Initialize */
count = num->n_len + num->n_scale;