Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fd6211c1 authored by Guillaume Melquiond's avatar Guillaume Melquiond
Browse files

Update Why3 and refresh generated files.

parent 6747a19a
No related branches found
No related tags found
No related merge requests found
#ifndef POWER_H_INCLUDED
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#define POWER_H_INCLUDED
#endif // POWER_H_INCLUDED
#include <stdlib.h>
#include "powm.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "array.h"
#include "map.h"
#include "c.h"
#include "int32.h"
#include "uint32gmp.h"
#include "uint64gmp.h"
#include "int.h"
#include "power.h"
#include "types.h"
#include "compare.h"
#include "util.h"
#include "utilold.h"
#include "addold.h"
#include "subold.h"
#include "mul.h"
#include "logicalutil.h"
#include "div.h"
#include "toom.h"
#include "euclideandivision.h"
#include "binverttab.h"
uint64_t binvert_limb_table (uint64_t n) {
return (uint64_t)binverttab[n];
return (uint64_t)binverttab[n];
}
void wmpn_redc_1(uint64_t * rp, uint64_t * up, uint64_t * mp, int32_t n,
......@@ -139,16 +99,9 @@ static inline void redcify(uint64_t * rp, uint64_t * up, int32_t un,
uint64_t * mp, int32_t n) {
uint64_t * tp;
uint64_t * qp;
int32_t i;
uint64_t lzero;
tp = alloca((uint32_t)(un + n) * sizeof(uint64_t));
qp = alloca((uint32_t)(un + 1) * sizeof(uint64_t));
i = 0;
lzero = UINT64_C(0);
while (i < n) {
tp[i] = lzero;
i = i + 1;
}
wmpn_zero(tp, n);
wmpn_copyi1(tp + n, up, un);
wmpn_tdiv_qr(qp, rp, 0, tp, un + n, mp, n);
return;
......@@ -203,9 +156,6 @@ void wmpn_powm(uint64_t * rp, uint64_t * bp, int32_t bn, uint64_t * ep,
int32_t this_windowsize;
int32_t ebh1;
uint64_t * ppn1;
uint64_t * o1;
int32_t i1;
uint64_t lzero;
le = ep[en - 1];
cnt = __builtin_clzll(le);
ebi = 64 * en - cnt;
......@@ -272,13 +222,7 @@ void wmpn_powm(uint64_t * rp, uint64_t * bp, int32_t bn, uint64_t * ep,
wmpn_redc_1(rp, tp, mp, n, mip);
}
wmpn_copyi1(tp, rp, n);
o1 = tp + n;
i1 = 0;
lzero = UINT64_C(0);
while (i1 < n) {
o1[i1] = lzero;
i1 = i1 + 1;
}
wmpn_zero(tp + n, n);
wmpn_redc_1(rp, tp, mp, n, mip);
if (wmpn_cmp(rp, mp, n) >= 0) {
wmpn_sub_n_in_place(rp, mp, n);
......@@ -287,4 +231,3 @@ void wmpn_powm(uint64_t * rp, uint64_t * bp, int32_t bn, uint64_t * ep,
return;
}
}
#ifndef POWM_H_INCLUDED
#include <stdlib.h>
#include "c.h"
#include "uint32gmp.h"
#include "uint64gmp.h"
#include "compare.h"
#include "util.h"
#include "utilold.h"
#include "addold.h"
#include "subold.h"
#include "mul.h"
#include "logicalutil.h"
#include "div.h"
#include "toom.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
void wmpn_redc_1(uint64_t * rp, uint64_t * up, uint64_t * mp, int32_t n,
uint64_t invm);
......
#ifndef REALINFIX_H_INCLUDED
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#define REALINFIX_H_INCLUDED
#endif // REALINFIX_H_INCLUDED
#include <stdlib.h>
#include "set.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "int.h"
#include "euclideandivision.h"
#include "abs.h"
#include "map.h"
#include "c.h"
#include "int32.h"
#include "int64.h"
#include "uint64gmp.h"
#include "z.h"
#include "zutil.h"
void wmpz_set_ui(wmpz_ptr dst, uint64_t src) {
uint64_t * dstp;
......@@ -79,4 +57,3 @@ uint64_t wmpz_get_ui(wmpz_ptr src) {
(void)(src);
return v;
}
#ifndef SET_H_INCLUDED
#include <stdlib.h>
#include "c.h"
#include "uint64gmp.h"
#include "z.h"
#include "zutil.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
void wmpz_set_ui(wmpz_ptr dst, uint64_t src);
uint64_t abs_cast(int64_t x);
......
#include "set_str.h"
#include <stdint.h>
int32_t wmpn_set_str_bits(uint64_t * rp, unsigned char * sp, uint32_t sn,
uint32_t bits) {
int32_t rn, j;
uint32_t shift;
uint64_t sj, rlow, slow, nr, shigh;
rn = 0;
shift = 0U;
j = (int32_t)sn;
while (j > 0) {
j = j - 1;
sj = (uint64_t)sp[j];
if (shift == 0U) {
rp[rn] = sj;
rn = rn + 1;
shift = bits;
} else {
rlow = rp[rn - 1];
slow = sj << (uint64_t)shift;
nr = rlow + slow;
rp[rn - 1] = nr;
shift = shift + bits;
if (shift >= 64U) {
shift = shift - 64U;
if (shift > 0U) {
shigh = sj >> (uint64_t)(bits - shift);
rp[rn] = shigh;
rn = rn + 1;
}
}
}
}
normalize(rp, &rn);
return rn;
}
int32_t wmpn_set_str_other(uint64_t * rp, unsigned char * sp, uint32_t sn,
uint64_t b, struct wmpn_base_info info) {
uint32_t k;
uint64_t w;
int32_t j;
uint32_t o;
uint64_t sj;
int32_t rn;
uint32_t k1, o1;
uint64_t sj1, o2, cy1;
uint64_t cy;
k = 1U + (sn - 1U) % info.exp;
w = (uint64_t)*sp;
j = 1;
while (1) {
k = k - 1U;
o = k;
if (!(o > 0U)) {
break;
}
sj = (uint64_t)sp[j];
w = w * b + sj;
j = j + 1;
}
*rp = w;
rn = 1;
while (j < (int32_t)sn) {
w = (uint64_t)sp[j];
j = j + 1;
o1 = info.exp - 1U;
if (1U <= o1) {
for (k1 = 1U; ; ++k1) {
sj1 = (uint64_t)sp[j];
w = w * b + sj1;
j = j + 1;
if (k1 == o1) {
break;
}
}
}
o2 = wmpn_mul_1_in_place(rp, rn, info.bb);
cy = o2;
cy1 = wmpn_add_1_in_place(rp, rn, w);
cy = cy + cy1;
if (cy > UINT64_C(0)) {
rp[rn] = cy;
rn = rn + 1;
}
}
return rn;
}
int32_t wmpn_set_str(uint64_t * rp, unsigned char * sp, uint32_t sn,
int32_t base) {
uint32_t bits;
struct wmpn_base_info info;
if (sn == 0U) {
return 0;
}
bits = wmpn_base_power_of_two_p((uint64_t)base);
if (!(bits == 0U)) {
return wmpn_set_str_bits(rp, sp, sn, bits);
} else {
info = wmpn_get_base_info((uint64_t)base);
return wmpn_set_str_other(rp, sp, sn, (uint64_t)base, info);
}
}
#ifndef SET_STR_H_INCLUDED
#include "uint64gmp.h"
#include "c.h"
#include "powm.h"
#include "logical.h"
#include "util.h"
#include "baseinfo.h"
#include "mul.h"
#include "add_1.h"
#include <stdint.h>
int32_t wmpn_set_str_bits(uint64_t * rp, unsigned char * sp, uint32_t sn,
uint32_t bits);
int32_t wmpn_set_str_other(uint64_t * rp, unsigned char * sp, uint32_t sn,
uint64_t b, struct wmpn_base_info info);
int32_t wmpn_set_str(uint64_t * rp, unsigned char * sp, uint32_t sn,
int32_t base);
#define SET_STR_H_INCLUDED
#endif // SET_STR_H_INCLUDED
#include <stdlib.h>
#include "sqrt.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "array.h"
#include "map.h"
#include "c.h"
#include "int32.h"
#include "uint64gmp.h"
#include "euclideandivision.h"
#include "int.h"
#include "power.h"
#include "types.h"
#include "compare.h"
#include "utilold.h"
#include "add_1.h"
#include "addold.h"
#include "sub_1.h"
#include "subold.h"
#include "mul.h"
#include "logicalutil.h"
#include "logical.h"
#include "div.h"
#include "sqrt1.h"
#include "alias.h"
#include "explog.h"
#include "toom.h"
uint64_t wmpn_sqrtrem2(uint64_t * sp, uint64_t * rp, uint64_t * np) {
uint64_t np0, o, prec, nph, rq, u, uh;
......@@ -58,7 +10,7 @@ uint64_t wmpn_sqrtrem2(uint64_t * sp, uint64_t * rp, uint64_t * np) {
o = sqrt1(rp, np[1]);
sp0 = o;
rp0 = *rp;
prec = (64) / UINT64_C(2);
prec = 64 / UINT64_C(2);
nph = np0 >> (prec + UINT64_C(1));
rp0 = (rp0 << (prec - UINT64_C(1))) + nph;
q = rp0 / sp0;
......@@ -143,7 +95,7 @@ uint64_t wmpn_dc_sqrtrem(uint64_t * sp, uint64_t * np, int32_t n,
IGNORE2(sp,scratch);
res;
st = sp[l - 1];
ql = q << ((64) - UINT64_C(1));
ql = q << (64 - UINT64_C(1));
qh = q >> UINT64_C(1);
sp[l - 1] = st + ql;
q = qh;
......@@ -304,4 +256,3 @@ int32_t wmpn_sqrtrem(uint64_t * sp, uint64_t * rp, uint64_t * np, int32_t n) {
}
return rn;
}
#ifndef SQRT_H_INCLUDED
#include <stdlib.h>
#include "c.h"
#include "uint64gmp.h"
#include "compare.h"
#include "utilold.h"
#include "add_1.h"
#include "addold.h"
#include "sub_1.h"
#include "subold.h"
#include "mul.h"
#include "logicalutil.h"
#include "logical.h"
#include "div.h"
#include "sqrt1.h"
#include "alias.h"
#include "toom.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
uint64_t wmpn_sqrtrem2(uint64_t * sp, uint64_t * rp, uint64_t * np);
uint64_t wmpn_dc_sqrtrem(uint64_t * sp, uint64_t * np, int32_t n,
......
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "int.h"
#include "euclideandivision.h"
#include "realinfix.h"
#include "square.h"
#include "uint64.h"
#include "power.h"
#include "map.h"
#include "c.h"
#include "fxp.h"
#include "sqrt1.h"
#include "sqrtinit.h"
uint64_t rsa_estimate (uint64_t a) {
uint64_t abits, x0;
abits = a >> 55;
x0 = 0x100 | invsqrttab[abits - 0x80];
return x0;
uint64_t abits, x0;
abits = a >> 55;
x0 = 0x100 | invsqrttab[abits - 0x80];
return x0;
}
uint64_t sqrt1(uint64_t * rp, uint64_t a0) {
......@@ -58,4 +35,3 @@ uint64_t sqrt1(uint64_t * rp, uint64_t a0) {
*rp = a0 - s;
return c;
}
#ifndef SQRT1_H_INCLUDED
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "c.h"
#include "fxp.h"
uint64_t sqrt1(uint64_t * rp, uint64_t a0);
#define SQRT1_H_INCLUDED
......
#ifndef SQUARE_H_INCLUDED
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#define SQUARE_H_INCLUDED
#endif // SQUARE_H_INCLUDED
#include <stdlib.h>
#include "sub.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "c.h"
#include "int.h"
#include "int32.h"
#include "uint64gmp.h"
#include "types.h"
#include "array.h"
#include "map.h"
#include "alias.h"
#include "power.h"
uint64_t wmpn_sub_n(uint64_t * r, uint64_t * x, uint64_t * y, int32_t sz) {
uint64_t lx, ly, b;
......@@ -161,4 +141,3 @@ uint64_t sub_ry(uint64_t * x, int32_t sx, uint64_t * y, int32_t sy) {
IGNORE3(y,sx,sx);
return res;
}
#ifndef SUB_H_INCLUDED
#include <stdlib.h>
#include "c.h"
#include "uint64gmp.h"
#include "alias.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
uint64_t wmpn_sub_n(uint64_t * r, uint64_t * x, uint64_t * y, int32_t sz);
uint64_t wmpn_sub(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
......
#include <stdlib.h>
#include "sub_1.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "int.h"
#include "int32.h"
#include "uint64gmp.h"
#include "power.h"
#include "c.h"
#include "array.h"
#include "map.h"
#include "types.h"
uint64_t wmpn_sub_1(uint64_t * r, uint64_t * x, int32_t sz, uint64_t y) {
uint64_t b, lx;
......@@ -113,4 +95,3 @@ uint64_t wmpn_sub_1_in_place(uint64_t * x, int32_t sz, uint64_t y) {
}
return b;
}
#ifndef SUB_1_H_INCLUDED
#include <stdlib.h>
#include "uint64gmp.h"
#include "c.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
uint64_t wmpn_sub_1(uint64_t * r, uint64_t * x, int32_t sz, uint64_t y);
void wmpn_decr(uint64_t * x, uint64_t y);
......
#include <stdlib.h>
#include "subold.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "c.h"
#include "int.h"
#include "int32.h"
#include "uint64gmp.h"
#include "types.h"
#include "array.h"
#include "map.h"
#include "power.h"
#include "alias.h"
uint64_t wmpn_sub_n1(uint64_t * r, uint64_t * x, uint64_t * y, int32_t sz) {
uint64_t lx, ly, b;
......@@ -116,4 +96,3 @@ uint64_t wmpn_sub_in_place(uint64_t * x, int32_t sx, uint64_t * y, int32_t sy) {
}
return b;
}
#ifndef SUBOLD_H_INCLUDED
#include <stdlib.h>
#include "c.h"
#include "uint64gmp.h"
#include "alias.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
uint64_t wmpn_sub_n1(uint64_t * r, uint64_t * x, uint64_t * y, int32_t sz);
uint64_t wmpn_sub1(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
......
#include <stdlib.h>
#include "toom.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <alloca.h>
#include "array.h"
#include "map.h"
#include "c.h"
#include "int32.h"
#include "uint64gmp.h"
#include "int.h"
#include "power.h"
#include "computerdivision.h"
#include "types.h"
#include "compare.h"
#include "util.h"
#include "utilold.h"
#include "add_1.h"
#include "addold.h"
#include "sub_1.h"
#include "subold.h"
#include "mul.h"
#include "mul_basecase.h"
#include "logical.h"
int32_t toom22_threshold() {
return 29;
}
int32_t toom22_threshold = 29;
void wmpn_toom22_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
int32_t sy, uint64_t * scratch);
......@@ -79,8 +37,6 @@ void wmpn_toom22_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
uint64_t * y0t;
int c0, c1;
uint64_t * ysm1t;
int32_t i;
uint64_t lzero;
uint64_t * v0;
uint64_t * v0n;
uint64_t * vinfn;
......@@ -135,12 +91,7 @@ void wmpn_toom22_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
if (c0 && c1) {
wmpn_sub_n1(ysm1, y1, y0, t);
ysm1t = ysm1 + t;
i = 0;
lzero = UINT64_C(0);
while (i < n - t) {
ysm1t[i] = lzero;
i = i + 1;
}
wmpn_zero(ysm1t, n - t);
vm1_neg = !(vm1_neg);
} else {
wmpn_sub1(ysm1, y0, n, y1, t);
......@@ -190,7 +141,7 @@ void wmpn_toom22_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
void wmpn_toom22_mul_rec(uint64_t * r, uint64_t * x, int32_t sx,
uint64_t * y, int32_t sy, uint64_t * scratch) {
if (sy <= toom22_threshold()) {
if (sy <= toom22_threshold) {
wmpn_mul_basecase(r, x, sx, y, sy);
return;
} else {
......@@ -206,7 +157,7 @@ void wmpn_toom22_mul_rec(uint64_t * r, uint64_t * x, int32_t sx,
void wmpn_toom22_mul_n_rec(uint64_t * r, uint64_t * x, uint64_t * y,
uint64_t * scratch, int32_t sz) {
if (sz <= toom22_threshold()) {
if (sz <= toom22_threshold) {
wmpn_mul_basecase(r, x, sz, y, sz);
return;
} else {
......@@ -241,8 +192,6 @@ void wmpn_toom32_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
int c0, c1;
int32_t cmp2;
uint64_t * ym1t;
int32_t i;
uint64_t lzero;
uint64_t cy;
uint64_t * sn;
uint64_t c2, c3;
......@@ -325,12 +274,7 @@ void wmpn_toom32_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
if (c0 && c1) {
wmpn_sub_n1(ym1, y1, y0, t);
ym1t = ym1 + t;
i = 0;
lzero = UINT64_C(0);
while (i < n - t) {
ym1t[i] = lzero;
i = i + 1;
}
wmpn_zero(ym1t, n - t);
vm1_neg = !(vm1_neg);
} else {
wmpn_sub1(ym1, y0, n, y1, t);
......@@ -460,7 +404,7 @@ uint64_t wmpn_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
uint64_t cy1;
uint64_t * rpn1;
uint64_t * wsy1;
if (sy <= toom22_threshold()) {
if (sy <= toom22_threshold) {
wmpn_mul_basecase(r, x, sx, y, sy);
} else {
scratch = alloca((uint32_t)(5 * sy + 128) * sizeof(uint64_t));
......@@ -516,7 +460,7 @@ uint64_t wmpn_mul(uint64_t * r, uint64_t * x, int32_t sx, uint64_t * y,
void wmpn_mul_n(uint64_t * r, uint64_t * x, uint64_t * y, int32_t sz) {
uint64_t * ws;
if (sz <= toom22_threshold()) {
if (sz <= toom22_threshold) {
wmpn_mul_basecase(r, x, sz, y, sz);
return;
} else {
......@@ -525,4 +469,3 @@ void wmpn_mul_n(uint64_t * r, uint64_t * x, uint64_t * y, int32_t sz) {
return;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment