43
43
* Converts BCD to long, going backwards from pointer n by the number of
44
44
* characters specified by len.
45
45
*/
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 )
47
47
{
48
- unsigned long num = 0 ;
49
- unsigned long base = 1 ;
48
+ BC_UINT_T num = 0 ;
49
+ BC_UINT_T base = 1 ;
50
50
51
51
for (size_t i = 0 ; i < len ; i ++ ) {
52
52
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
66
66
char * n1end = n1 -> n_value + n1len - 1 ;
67
67
char * n2end = n2 -> n_value + n2len - 1 ;
68
68
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 ;
72
72
73
73
size_t prodlen = n1len + n2len ;
74
74
* 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
82
82
}
83
83
84
84
/*
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 .
86
86
* The array is generated starting with the smaller digits.
87
87
* e.g. 12345678901234567890 => {34567890, 56789012, 1234}
88
88
*
@@ -100,11 +100,11 @@ static void bc_standard_mul(bc_num n1, size_t n1len, bc_num n2, int n2len, bc_nu
100
100
size_t n2_arr_size = n2len / BC_LONGABLE_DIGITS + (n2len % BC_LONGABLE_DIGITS ? 1 : 0 );
101
101
size_t prod_arr_size = n1_arr_size + n2_arr_size - 1 ;
102
102
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 ));
104
104
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 ;
108
108
109
109
for (i = 0 ; i < prod_arr_size ; i ++ ) {
110
110
prod_l [i ] = 0 ;
0 commit comments