Skip to content

Commit 788a884

Browse files
committed
Merged bc_mul_finish_from_vector into bc_standard_mul
1 parent 3ff726a commit 788a884

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

ext/bcmath/libbcmath/src/recmul.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,6 @@ static inline void bc_fast_mul(bc_num n1, size_t n1len, bc_num n2, size_t n2len,
7272
}
7373
}
7474

75-
/* Common part of functions bc_standard_mul and bc_standard_square
76-
* that takes a vector and converts it to a bc_num */
77-
static inline void bc_mul_finish_from_vector(BC_VECTOR *prod_vector, size_t prod_arr_size, size_t prodlen, bc_num *prod) {
78-
/*
79-
* Move a value exceeding 4/8 digits by carrying to the next digit.
80-
* However, the last digit does nothing.
81-
*/
82-
bc_mul_carry_calc(prod_vector, prod_arr_size);
83-
84-
/* Convert to bc_num */
85-
*prod = bc_new_num_nonzeroed(prodlen, 0);
86-
char *pptr = (*prod)->n_value;
87-
char *pend = pptr + prodlen - 1;
88-
89-
bc_convert_vector_to_char(prod_vector, pptr, pend, prod_arr_size);
90-
}
91-
9275
/*
9376
* Converts the BCD of bc_num by 4 (32 bits) or 8 (64 bits) digits to an array of BC_VECTOR.
9477
* The array is generated starting with the smaller digits.
@@ -151,7 +134,17 @@ static void bc_standard_mul(bc_num n1, size_t n1len, bc_num n2, size_t n2len, bc
151134
}
152135
}
153136

154-
bc_mul_finish_from_vector(prod_vector, prod_arr_size, prodlen, prod);
137+
/*
138+
* Move a value exceeding 4/8 digits by carrying to the next digit.
139+
* However, the last digit does nothing.
140+
*/
141+
bc_mul_carry_calc(prod_vector, prod_arr_size);
142+
143+
/* Convert to bc_num */
144+
*prod = bc_new_num_nonzeroed(prodlen, 0);
145+
char *pptr = (*prod)->n_value;
146+
char *pend = pptr + prodlen - 1;
147+
bc_convert_vector_to_char(prod_vector, pptr, pend, prod_arr_size);
155148

156149
if (allocation_arr_size > BC_STACK_VECTOR_SIZE) {
157150
efree(n1_vector);

0 commit comments

Comments
 (0)