Lines Matching refs:bia
243 bigint *bi_add(BI_CTX *ctx, bigint *bia, bigint *bib) in bi_add() argument
249 check(bia); in bi_add()
252 n = max(bia->size, bib->size); in bi_add()
253 more_comps(bia, n+1); in bi_add()
255 pa = bia->comps; in bi_add()
270 return trim(bia); in bi_add()
283 bigint *bia, bigint *bib, int *is_negative) in bi_subtract() argument
285 int n = bia->size; in bi_subtract()
288 check(bia); in bi_subtract()
292 pa = bia->comps; in bi_subtract()
311 return trim(bia); in bi_subtract()
317 static bigint *bi_int_multiply(BI_CTX *ctx, bigint *bia, comp b) in bi_int_multiply() argument
319 int j = 0, n = bia->size; in bi_int_multiply()
323 comp *a = bia->comps; in bi_int_multiply()
325 check(bia); in bi_int_multiply()
338 bi_free(ctx, bia); in bi_int_multiply()
773 static bigint *regular_multiply(BI_CTX *ctx, bigint *bia, bigint *bib) in regular_multiply() argument
776 int n = bia->size; in regular_multiply()
780 comp *sa = bia->comps; in regular_multiply()
783 check(bia); in regular_multiply()
807 bi_free(ctx, bia); in regular_multiply()
818 static bigint *karatsuba(BI_CTX *ctx, bigint *bia, bigint *bib, int is_square) in karatsuba() argument
826 m = (bia->size + 1)/2; in karatsuba()
830 m = (max(bia->size, bib->size) + 1)/2; in karatsuba()
833 x0 = bi_clone(ctx, bia); in karatsuba()
835 x1 = bi_clone(ctx, bia); in karatsuba()
837 bi_free(ctx, bia); in karatsuba()
876 bigint *bi_multiply(BI_CTX *ctx, bigint *bia, bigint *bib) in bi_multiply() argument
878 check(bia); in bi_multiply()
882 if (min(bia->size, bib->size) < MUL_KARATSUBA_THRESH) in bi_multiply()
884 return regular_multiply(ctx, bia, bib); in bi_multiply()
887 return karatsuba(ctx, bia, bib, 0); in bi_multiply()
889 return regular_multiply(ctx, bia, bib); in bi_multiply()
954 bigint *bi_square(BI_CTX *ctx, bigint *bia) in bi_square() argument
956 check(bia); in bi_square()
959 if (bia->size < SQU_KARATSUBA_THRESH) in bi_square()
961 return regular_square(ctx, bia); in bi_square()
964 return karatsuba(ctx, bia, NULL, 1); in bi_square()
966 return regular_square(ctx, bia); in bi_square()
977 int bi_compare(bigint *bia, bigint *bib) in bi_compare() argument
981 check(bia); in bi_compare()
984 if (bia->size > bib->size) in bi_compare()
986 else if (bia->size < bib->size) in bi_compare()
990 comp *a = bia->comps; in bi_compare()
996 i = bia->size - 1; in bi_compare()
1218 static bigint *partial_multiply(BI_CTX *ctx, bigint *bia, bigint *bib, in partial_multiply() argument
1221 int i = 0, j, n = bia->size, t = bib->size; in partial_multiply()
1226 check(bia); in partial_multiply()
1230 sa = bia->comps; in partial_multiply()
1242 bi_free(ctx, bia); in partial_multiply()
1283 bi_free(ctx, bia); in partial_multiply()