Skip to content

Commit 7a944c7

Browse files
committed
Changed unsigned long to BC_UINT_T
1 parent 2261b78 commit 7a944c7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ext/bcmath/libbcmath/src/recmul.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
* Converts BCD to long, going backwards from pointer n by the number of
4444
* characters specified by len.
4545
*/
46-
static inline unsigned long bc_partial_convert_to_long(const char *n, size_t len)
46+
static inline BC_UINT_T bc_partial_convert_to_long(const char *n, size_t len)
4747
{
48-
unsigned long num = 0;
49-
unsigned long base = 1;
48+
BC_UINT_T num = 0;
49+
BC_UINT_T base = 1;
5050

5151
for (size_t i = 0; i < len; i++) {
5252
num += *n * base;
@@ -66,9 +66,9 @@ static inline void bc_fast_mul(bc_num n1, size_t n1len, bc_num n2, int n2len, bc
6666
char *n1end = n1->n_value + n1len - 1;
6767
char *n2end = n2->n_value + n2len - 1;
6868

69-
unsigned long n1_l = bc_partial_convert_to_long(n1end, n1len);
70-
unsigned long n2_l = bc_partial_convert_to_long(n2end, n2len);
71-
unsigned long prod_l = n1_l * n2_l;
69+
BC_UINT_T n1_l = bc_partial_convert_to_long(n1end, n1len);
70+
BC_UINT_T n2_l = bc_partial_convert_to_long(n2end, n2len);
71+
BC_UINT_T prod_l = n1_l * n2_l;
7272

7373
size_t prodlen = n1len + n2len;
7474
*prod = bc_new_num_nonzeroed(prodlen, 0);
@@ -82,7 +82,7 @@ static inline void bc_fast_mul(bc_num n1, size_t n1len, bc_num n2, int n2len, bc
8282
}
8383

8484
/*
85-
* Converts the BCD of bc_num by 4 (32 bits) or 8 (64 bits) digits to an array of unsigned longs.
85+
* Converts the BCD of bc_num by 4 (32 bits) or 8 (64 bits) digits to an array of BC_UINT_Ts.
8686
* The array is generated starting with the smaller digits.
8787
* e.g. 12345678901234567890 => {34567890, 56789012, 1234}
8888
*
@@ -100,11 +100,11 @@ static void bc_standard_mul(bc_num n1, size_t n1len, bc_num n2, int n2len, bc_nu
100100
size_t n2_arr_size = n2len / BC_LONGABLE_DIGITS + (n2len % BC_LONGABLE_DIGITS ? 1 : 0);
101101
size_t prod_arr_size = n1_arr_size + n2_arr_size - 1;
102102

103-
unsigned long *buf = emalloc((n1_arr_size + n2_arr_size + prod_arr_size) * sizeof(unsigned long));
103+
BC_UINT_T *buf = emalloc((n1_arr_size + n2_arr_size + prod_arr_size) * sizeof(BC_UINT_T));
104104

105-
unsigned long *n1_l = buf;
106-
unsigned long *n2_l = buf + n1_arr_size;
107-
unsigned long *prod_l = n2_l + n2_arr_size;
105+
BC_UINT_T *n1_l = buf;
106+
BC_UINT_T *n2_l = buf + n1_arr_size;
107+
BC_UINT_T *prod_l = n2_l + n2_arr_size;
108108

109109
for (i = 0; i < prod_arr_size; i++) {
110110
prod_l[i] = 0;

0 commit comments

Comments
 (0)