diff options
-rw-r--r-- | miscutils/bc.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 19e567b88..eae91e9c5 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -205,9 +205,6 @@ typedef struct BcVec { | |||
205 | BcVecFree dtor; | 205 | BcVecFree dtor; |
206 | } BcVec; | 206 | } BcVec; |
207 | 207 | ||
208 | #define bc_vec_pop(v) (bc_vec_npop((v), 1)) | ||
209 | #define bc_vec_top(v) (bc_vec_item_rev((v), 0)) | ||
210 | |||
211 | typedef signed char BcDig; | 208 | typedef signed char BcDig; |
212 | 209 | ||
213 | typedef struct BcNum { | 210 | typedef struct BcNum { |
@@ -218,16 +215,17 @@ typedef struct BcNum { | |||
218 | bool neg; | 215 | bool neg; |
219 | } BcNum; | 216 | } BcNum; |
220 | 217 | ||
221 | #define BC_NUM_MIN_BASE ((unsigned long) 2) | 218 | #define BC_NUM_MIN_BASE ((unsigned long) 2) |
222 | #define BC_NUM_MAX_IBASE ((unsigned long) 16) | 219 | #define BC_NUM_MAX_IBASE ((unsigned long) 16) |
223 | #define BC_NUM_DEF_SIZE (16) | 220 | // larger value might speed up BIGNUM calculations a bit: |
224 | #define BC_NUM_PRINT_WIDTH (69) | 221 | #define BC_NUM_DEF_SIZE (16) |
222 | #define BC_NUM_PRINT_WIDTH (69) | ||
225 | 223 | ||
226 | #define BC_NUM_KARATSUBA_LEN (32) | 224 | #define BC_NUM_KARATSUBA_LEN (32) |
227 | 225 | ||
228 | #define BC_NUM_NEG(n, neg) ((((ssize_t)(n)) ^ -((ssize_t)(neg))) + (neg)) | 226 | #define BC_NUM_NEG(n, neg) ((((ssize_t)(n)) ^ -((ssize_t)(neg))) + (neg)) |
229 | #define BC_NUM_ONE(n) ((n)->len == 1 && (n)->rdx == 0 && (n)->num[0] == 1) | 227 | #define BC_NUM_ONE(n) ((n)->len == 1 && (n)->rdx == 0 && (n)->num[0] == 1) |
230 | #define BC_NUM_INT(n) ((n)->len - (n)->rdx) | 228 | #define BC_NUM_INT(n) ((n)->len - (n)->rdx) |
231 | #define BC_NUM_AREQ(a, b) \ | 229 | #define BC_NUM_AREQ(a, b) \ |
232 | (BC_MAX((a)->rdx, (b)->rdx) + BC_MAX(BC_NUM_INT(a), BC_NUM_INT(b)) + 1) | 230 | (BC_MAX((a)->rdx, (b)->rdx) + BC_MAX(BC_NUM_INT(a), BC_NUM_INT(b)) + 1) |
233 | #define BC_NUM_MREQ(a, b, scale) \ | 231 | #define BC_NUM_MREQ(a, b, scale) \ |
@@ -1078,6 +1076,9 @@ static void bc_vec_expand(BcVec *v, size_t req) | |||
1078 | } | 1076 | } |
1079 | } | 1077 | } |
1080 | 1078 | ||
1079 | #define bc_vec_pop(v) (bc_vec_npop((v), 1)) | ||
1080 | #define bc_vec_top(v) (bc_vec_item_rev((v), 0)) | ||
1081 | |||
1081 | static void bc_vec_npop(BcVec *v, size_t n) | 1082 | static void bc_vec_npop(BcVec *v, size_t n) |
1082 | { | 1083 | { |
1083 | if (!v->dtor) | 1084 | if (!v->dtor) |