Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifications #434

Merged
merged 13 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ matrix:
# clang for x86-64 architecture (64-bit longs and 64-bit pointers)
- env: SANITIZER=1 CONV_WARNINGS=relaxed BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 CONV_WARNINGS=strict BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 CONV_WARNINGS=strict BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_USE_MEMOPS --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 CONV_WARNINGS=strict BUILDOPTIONS='--with-cc=clang-7 --c89 --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind --cflags=-DMP_PREC=MP_MIN_PREC'
- env: SANITIZER=1 BUILDOPTIONS='--with-cc=clang-6.0 --with-m64 --with-travis-valgrind'
Expand Down
4 changes: 2 additions & 2 deletions demo/mtest_opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ static int mtest_opponent(void)

#ifndef MP_FIXED_CUTOFFS
/* force KARA and TOOM to enable despite cutoffs */
MP_KARATSUBA_SQR_CUTOFF = MP_KARATSUBA_MUL_CUTOFF = 8;
MP_TOOM_SQR_CUTOFF = MP_TOOM_MUL_CUTOFF = 16;
MP_SQR_KARATSUBA_CUTOFF = MP_MUL_KARATSUBA_CUTOFF = 8;
MP_SQR_TOOM_CUTOFF = MP_MUL_TOOM_CUTOFF = 16;
#endif

for (;;) {
Expand Down
54 changes: 27 additions & 27 deletions demo/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ static int test_mp_root_u32(void)
return EXIT_FAILURE;
}

static int test_s_mp_balance_mul(void)
static int test_s_mp_mul_balance(void)
{
mp_int a, b, c;

Expand All @@ -1881,7 +1881,7 @@ static int test_s_mp_balance_mul(void)
DO(mp_read_radix(&a, na, 64));
DO(mp_read_radix(&b, nb, 64));

DO(s_mp_balance_mul(&a, &b, &c));
DO(s_mp_mul_balance(&a, &b, &c));

DO(mp_read_radix(&b, nc, 64));

Expand All @@ -1896,18 +1896,18 @@ static int test_s_mp_balance_mul(void)
return EXIT_FAILURE;
}

#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
static int test_s_mp_karatsuba_mul(void)
#define s_mp_mul_full(a, b, c) s_mp_mul(a, b, c, (a)->used + (b)->used + 1)
static int test_s_mp_mul_karatsuba(void)
{
mp_int a, b, c, d;
int size;

DOR(mp_init_multi(&a, &b, &c, &d, NULL));
for (size = MP_KARATSUBA_MUL_CUTOFF; size < MP_KARATSUBA_MUL_CUTOFF + 20; size++) {
for (size = MP_MUL_KARATSUBA_CUTOFF; size < MP_MUL_KARATSUBA_CUTOFF + 20; size++) {
DO(mp_rand(&a, size));
DO(mp_rand(&b, size));
DO(s_mp_karatsuba_mul(&a, &b, &c));
DO(s_mp_mul(&a,&b,&d));
DO(s_mp_mul_karatsuba(&a, &b, &c));
DO(s_mp_mul_full(&a,&b,&d));
if (mp_cmp(&c, &d) != MP_EQ) {
fprintf(stderr, "Karatsuba multiplication failed at size %d\n", size);
goto LBL_ERR;
Expand All @@ -1921,15 +1921,15 @@ static int test_s_mp_karatsuba_mul(void)
return EXIT_FAILURE;
}

static int test_s_mp_karatsuba_sqr(void)
static int test_s_mp_sqr_karatsuba(void)
{
mp_int a, b, c;
int size;

DOR(mp_init_multi(&a, &b, &c, NULL));
for (size = MP_KARATSUBA_SQR_CUTOFF; size < MP_KARATSUBA_SQR_CUTOFF + 20; size++) {
for (size = MP_SQR_KARATSUBA_CUTOFF; size < MP_SQR_KARATSUBA_CUTOFF + 20; size++) {
DO(mp_rand(&a, size));
DO(s_mp_karatsuba_sqr(&a, &b));
DO(s_mp_sqr_karatsuba(&a, &b));
DO(s_mp_sqr(&a, &c));
if (mp_cmp(&b, &c) != MP_EQ) {
fprintf(stderr, "Karatsuba squaring failed at size %d\n", size);
Expand All @@ -1944,7 +1944,7 @@ static int test_s_mp_karatsuba_sqr(void)
return EXIT_FAILURE;
}

static int test_s_mp_toom_mul(void)
static int test_s_mp_mul_toom(void)
{
mp_int a, b, c, d;
int size;
Expand All @@ -1965,22 +1965,22 @@ static int test_s_mp_toom_mul(void)
DO(mp_2expt(&c, 99000 - 1000));
DO(mp_add(&b, &c, &b));

tc_cutoff = MP_TOOM_MUL_CUTOFF;
MP_TOOM_MUL_CUTOFF = INT_MAX;
tc_cutoff = MP_MUL_TOOM_CUTOFF;
MP_MUL_TOOM_CUTOFF = INT_MAX;
DO(mp_mul(&a, &b, &c));
MP_TOOM_MUL_CUTOFF = tc_cutoff;
MP_MUL_TOOM_CUTOFF = tc_cutoff;
DO(mp_mul(&a, &b, &d));
if (mp_cmp(&c, &d) != MP_EQ) {
fprintf(stderr, "Toom-Cook 3-way multiplication failed for edgecase f1 * f2\n");
goto LBL_ERR;
}
#endif

for (size = MP_TOOM_MUL_CUTOFF; size < MP_TOOM_MUL_CUTOFF + 20; size++) {
for (size = MP_MUL_TOOM_CUTOFF; size < MP_MUL_TOOM_CUTOFF + 20; size++) {
DO(mp_rand(&a, size));
DO(mp_rand(&b, size));
DO(s_mp_toom_mul(&a, &b, &c));
DO(s_mp_mul(&a,&b,&d));
DO(s_mp_mul_toom(&a, &b, &c));
DO(s_mp_mul_full(&a,&b,&d));
if (mp_cmp(&c, &d) != MP_EQ) {
fprintf(stderr, "Toom-Cook 3-way multiplication failed at size %d\n", size);
goto LBL_ERR;
Expand All @@ -1994,15 +1994,15 @@ static int test_s_mp_toom_mul(void)
return EXIT_FAILURE;
}

static int test_s_mp_toom_sqr(void)
static int test_s_mp_sqr_toom(void)
{
mp_int a, b, c;
int size;

DOR(mp_init_multi(&a, &b, &c, NULL));
for (size = MP_TOOM_SQR_CUTOFF; size < MP_TOOM_SQR_CUTOFF + 20; size++) {
for (size = MP_SQR_TOOM_CUTOFF; size < MP_SQR_TOOM_CUTOFF + 20; size++) {
DO(mp_rand(&a, size));
DO(s_mp_toom_sqr(&a, &b));
DO(s_mp_sqr_toom(&a, &b));
DO(s_mp_sqr(&a, &c));
if (mp_cmp(&b, &c) != MP_EQ) {
fprintf(stderr, "Toom-Cook 3-way squaring failed at size %d\n", size);
Expand Down Expand Up @@ -2075,7 +2075,7 @@ static int test_s_mp_div_recursive(void)

DOR(mp_init_multi(&a, &b, &c_q, &c_r, &d_q, &d_r, NULL));

for (size = MP_KARATSUBA_MUL_CUTOFF; size < 3 * MP_KARATSUBA_MUL_CUTOFF; size += 10) {
for (size = MP_MUL_KARATSUBA_CUTOFF; size < 3 * MP_MUL_KARATSUBA_CUTOFF; size += 10) {
printf("\rsizes = %d / %d", 10 * size, size);
/* Relation 10:1 */
DO(mp_rand(&a, 10 * size));
Expand Down Expand Up @@ -2139,7 +2139,7 @@ static int test_s_mp_div_small(void)
int size;

DOR(mp_init_multi(&a, &b, &c_q, &c_r, &d_q, &d_r, NULL));
for (size = 1; size < MP_KARATSUBA_MUL_CUTOFF; size += 10) {
for (size = 1; size < MP_MUL_KARATSUBA_CUTOFF; size += 10) {
printf("\rsizes = %d / %d", 2 * size, size);
/* Relation 10:1 */
DO(mp_rand(&a, 2 * size));
Expand Down Expand Up @@ -2332,11 +2332,11 @@ static int unit_tests(int argc, char **argv)
T1(mp_xor, MP_XOR),
T2(s_mp_div_recursive, S_MP_DIV_RECURSIVE, S_MP_DIV_SCHOOL),
T2(s_mp_div_small, S_MP_DIV_SMALL, S_MP_DIV_SCHOOL),
T1(s_mp_balance_mul, S_MP_BALANCE_MUL),
T1(s_mp_karatsuba_mul, S_MP_KARATSUBA_MUL),
T1(s_mp_karatsuba_sqr, S_MP_KARATSUBA_SQR),
T1(s_mp_toom_mul, S_MP_TOOM_MUL),
T1(s_mp_toom_sqr, S_MP_TOOM_SQR)
T1(s_mp_mul_balance, S_MP_MUL_BALANCE),
T1(s_mp_mul_karatsuba, S_MP_MUL_KARATSUBA),
T1(s_mp_sqr_karatsuba, S_MP_SQR_KARATSUBA),
T1(s_mp_mul_toom, S_MP_MUL_TOOM),
T1(s_mp_sqr_toom, S_MP_SQR_TOOM)
#undef T2
#undef T1
};
Expand Down
12 changes: 6 additions & 6 deletions demo/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,18 +247,18 @@ int main(int argc, char **argv)

if (should_test("mulsqr", argc, argv) != 0) {
/* do mult/square twice, first without karatsuba and second with */
old_kara_m = MP_KARATSUBA_MUL_CUTOFF;
old_kara_s = MP_KARATSUBA_SQR_CUTOFF;
old_kara_m = MP_MUL_KARATSUBA_CUTOFF;
old_kara_s = MP_SQR_KARATSUBA_CUTOFF;
/* currently toom-cook cut-off is too high to kick in, so we just use the karatsuba values */
old_toom_m = old_kara_m;
old_toom_s = old_kara_s;
for (ix = 0; ix < 3; ix++) {
printf("With%s Karatsuba, With%s Toom\n", (ix == 1) ? "" : "out", (ix == 2) ? "" : "out");

MP_KARATSUBA_MUL_CUTOFF = (ix == 1) ? old_kara_m : 9999;
MP_KARATSUBA_SQR_CUTOFF = (ix == 1) ? old_kara_s : 9999;
MP_TOOM_MUL_CUTOFF = (ix == 2) ? old_toom_m : 9999;
MP_TOOM_SQR_CUTOFF = (ix == 2) ? old_toom_s : 9999;
MP_MUL_KARATSUBA_CUTOFF = (ix == 1) ? old_kara_m : 9999;
MP_SQR_KARATSUBA_CUTOFF = (ix == 1) ? old_kara_s : 9999;
MP_MUL_TOOM_CUTOFF = (ix == 2) ? old_toom_m : 9999;
MP_SQR_TOOM_CUTOFF = (ix == 2) ? old_toom_s : 9999;

log = FOPEN((ix == 0) ? "logs/mult" MP_TIMING_VERSION ".log" : (ix == 1) ? "logs/mult_kara" MP_TIMING_VERSION ".log" :
"logs/mult_toom" MP_TIMING_VERSION ".log", "w");
Expand Down
74 changes: 37 additions & 37 deletions etc/tune.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int s_number_of_test_loops;
static int s_stabilization_extra;
static int s_offset = 1;

#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
#define s_mp_mul_full(a, b, c) s_mp_mul(a, b, c, (a)->used + (b)->used + 1)
static uint64_t s_time_mul(int size)
{
int x;
Expand Down Expand Up @@ -87,7 +87,7 @@ static uint64_t s_time_mul(int size)
goto LBL_ERR;
}
if (s_check_result == 1) {
if ((e = s_mp_mul(&a,&b,&d)) != MP_OKAY) {
if ((e = s_mp_mul_full(&a,&b,&d)) != MP_OKAY) {
t1 = UINT64_MAX;
goto LBL_ERR;
}
Expand Down Expand Up @@ -247,27 +247,27 @@ static void s_usage(char *s)
}

struct cutoffs {
int KARATSUBA_MUL, KARATSUBA_SQR;
int TOOM_MUL, TOOM_SQR;
int MUL_KARATSUBA, SQR_KARATSUBA;
int MUL_TOOM, SQR_TOOM;
};

const struct cutoffs max_cutoffs =
{ INT_MAX, INT_MAX, INT_MAX, INT_MAX };

static void set_cutoffs(const struct cutoffs *c)
{
MP_KARATSUBA_MUL_CUTOFF = c->KARATSUBA_MUL;
MP_KARATSUBA_SQR_CUTOFF = c->KARATSUBA_SQR;
MP_TOOM_MUL_CUTOFF = c->TOOM_MUL;
MP_TOOM_SQR_CUTOFF = c->TOOM_SQR;
MP_MUL_KARATSUBA_CUTOFF = c->MUL_KARATSUBA;
MP_SQR_KARATSUBA_CUTOFF = c->SQR_KARATSUBA;
MP_MUL_TOOM_CUTOFF = c->MUL_TOOM;
MP_SQR_TOOM_CUTOFF = c->SQR_TOOM;
}

static void get_cutoffs(struct cutoffs *c)
{
c->KARATSUBA_MUL = MP_KARATSUBA_MUL_CUTOFF;
c->KARATSUBA_SQR = MP_KARATSUBA_SQR_CUTOFF;
c->TOOM_MUL = MP_TOOM_MUL_CUTOFF;
c->TOOM_SQR = MP_TOOM_SQR_CUTOFF;
c->MUL_KARATSUBA = MP_MUL_KARATSUBA_CUTOFF;
c->SQR_KARATSUBA = MP_SQR_KARATSUBA_CUTOFF;
c->MUL_TOOM = MP_MUL_TOOM_CUTOFF;
c->SQR_TOOM = MP_SQR_TOOM_CUTOFF;

}

Expand All @@ -292,7 +292,7 @@ int main(int argc, char **argv)
s_number_of_test_loops = 64;
s_stabilization_extra = 3;

MP_ZERO_BUFFER(&args, sizeof(args));
s_mp_zero_buf(&args, sizeof(args));

args.testmode = 0;
args.verbose = 0;
Expand Down Expand Up @@ -414,13 +414,13 @@ int main(int argc, char **argv)
s_usage(argv[0]);
}
str = argv[opt];
MP_KARATSUBA_MUL_CUTOFF = (int)s_strtol(str, &endptr, "[1/4] No value for MP_KARATSUBA_MUL_CUTOFF given");
MP_MUL_KARATSUBA_CUTOFF = (int)s_strtol(str, &endptr, "[1/4] No value for MP_MUL_KARATSUBA_CUTOFF given");
str = endptr + 1;
MP_KARATSUBA_SQR_CUTOFF = (int)s_strtol(str, &endptr, "[2/4] No value for MP_KARATSUBA_SQR_CUTOFF given");
MP_SQR_KARATSUBA_CUTOFF = (int)s_strtol(str, &endptr, "[2/4] No value for MP_SQR_KARATSUBA_CUTOFF given");
str = endptr + 1;
MP_TOOM_MUL_CUTOFF = (int)s_strtol(str, &endptr, "[3/4] No value for MP_TOOM_MUL_CUTOFF given");
MP_MUL_TOOM_CUTOFF = (int)s_strtol(str, &endptr, "[3/4] No value for MP_MUL_TOOM_CUTOFF given");
str = endptr + 1;
MP_TOOM_SQR_CUTOFF = (int)s_strtol(str, &endptr, "[4/4] No value for MP_TOOM_SQR_CUTOFF given");
MP_SQR_TOOM_CUTOFF = (int)s_strtol(str, &endptr, "[4/4] No value for MP_SQR_TOOM_CUTOFF given");
break;
case 'h':
s_exit_code = EXIT_SUCCESS;
Expand Down Expand Up @@ -455,10 +455,10 @@ int main(int argc, char **argv)
of the macro MP_WPARRAY in tommath.h which needs to
be changed manually (to 0 (zero)).
*/
T_MUL_SQR("Karatsuba multiplication", KARATSUBA_MUL, s_time_mul),
T_MUL_SQR("Karatsuba squaring", KARATSUBA_SQR, s_time_sqr),
T_MUL_SQR("Toom-Cook 3-way multiplying", TOOM_MUL, s_time_mul),
T_MUL_SQR("Toom-Cook 3-way squaring", TOOM_SQR, s_time_sqr),
T_MUL_SQR("Karatsuba multiplication", MUL_KARATSUBA, s_time_mul),
T_MUL_SQR("Karatsuba squaring", SQR_KARATSUBA, s_time_sqr),
T_MUL_SQR("Toom-Cook 3-way multiplying", MUL_TOOM, s_time_mul),
T_MUL_SQR("Toom-Cook 3-way squaring", SQR_TOOM, s_time_sqr),
#undef T_MUL_SQR
};
/* Turn all limits from bncore.c to the max */
Expand All @@ -473,15 +473,15 @@ int main(int argc, char **argv)
}
if (args.terse == 1) {
printf("%d %d %d %d\n",
updated.KARATSUBA_MUL,
updated.KARATSUBA_SQR,
updated.TOOM_MUL,
updated.TOOM_SQR);
updated.MUL_KARATSUBA,
updated.SQR_KARATSUBA,
updated.MUL_TOOM,
updated.SQR_TOOM);
} else {
printf("KARATSUBA_MUL_CUTOFF = %d\n", updated.KARATSUBA_MUL);
printf("KARATSUBA_SQR_CUTOFF = %d\n", updated.KARATSUBA_SQR);
printf("TOOM_MUL_CUTOFF = %d\n", updated.TOOM_MUL);
printf("TOOM_SQR_CUTOFF = %d\n", updated.TOOM_SQR);
printf("MUL_KARATSUBA_CUTOFF = %d\n", updated.MUL_KARATSUBA);
printf("SQR_KARATSUBA_CUTOFF = %d\n", updated.SQR_KARATSUBA);
printf("MUL_TOOM_CUTOFF = %d\n", updated.MUL_TOOM);
printf("SQR_TOOM_CUTOFF = %d\n", updated.SQR_TOOM);
}

if (args.print == 1) {
Expand Down Expand Up @@ -526,15 +526,15 @@ int main(int argc, char **argv)
set_cutoffs(&orig);
if (args.terse == 1) {
printf("%d %d %d %d\n",
MP_KARATSUBA_MUL_CUTOFF,
MP_KARATSUBA_SQR_CUTOFF,
MP_TOOM_MUL_CUTOFF,
MP_TOOM_SQR_CUTOFF);
MP_MUL_KARATSUBA_CUTOFF,
MP_SQR_KARATSUBA_CUTOFF,
MP_MUL_TOOM_CUTOFF,
MP_SQR_TOOM_CUTOFF);
} else {
printf("KARATSUBA_MUL_CUTOFF = %d\n", MP_KARATSUBA_MUL_CUTOFF);
printf("KARATSUBA_SQR_CUTOFF = %d\n", MP_KARATSUBA_SQR_CUTOFF);
printf("TOOM_MUL_CUTOFF = %d\n", MP_TOOM_MUL_CUTOFF);
printf("TOOM_SQR_CUTOFF = %d\n", MP_TOOM_SQR_CUTOFF);
printf("MUL_KARATSUBA_CUTOFF = %d\n", MP_MUL_KARATSUBA_CUTOFF);
printf("SQR_KARATSUBA_CUTOFF = %d\n", MP_SQR_KARATSUBA_CUTOFF);
printf("MUL_TOOM_CUTOFF = %d\n", MP_MUL_TOOM_CUTOFF);
printf("SQR_TOOM_CUTOFF = %d\n", MP_SQR_TOOM_CUTOFF);
}
}
}
Expand Down
17 changes: 8 additions & 9 deletions etc/tune_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,14 @@ i=$(tail -n +2 $FILE_NAME | wc -l)
# our median point will be at $i entries
i=$(( (i / 2) + 1 ))
TMP=$(median $FILE_NAME 1 $i)
echo "#define MP_DEFAULT_KARATSUBA_MUL_CUTOFF $TMP"
echo "#define MP_DEFAULT_KARATSUBA_MUL_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(km) Appending to $TOMMATH_CUTOFFS_H" $?
echo "#define MP_DEFAULT_MUL_KARATSUBA_CUTOFF $TMP"
echo "#define MP_DEFAULT_MUL_KARATSUBA_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(km) Appending to $TOMMATH_CUTOFFS_H" $?
TMP=$(median $FILE_NAME 2 $i)
echo "#define MP_DEFAULT_KARATSUBA_SQR_CUTOFF $TMP"
echo "#define MP_DEFAULT_KARATSUBA_SQR_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(ks) Appending to $TOMMATH_CUTOFFS_H" $?
echo "#define MP_DEFAULT_SQR_KARATSUBA_CUTOFF $TMP"
echo "#define MP_DEFAULT_SQR_KARATSUBA_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(ks) Appending to $TOMMATH_CUTOFFS_H" $?
TMP=$(median $FILE_NAME 3 $i)
echo "#define MP_DEFAULT_TOOM_MUL_CUTOFF $TMP"
echo "#define MP_DEFAULT_TOOM_MUL_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(tc3m) Appending to $TOMMATH_CUTOFFS_H" $?
echo "#define MP_DEFAULT_MUL_TOOM_CUTOFF $TMP"
echo "#define MP_DEFAULT_MUL_TOOM_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(tc3m) Appending to $TOMMATH_CUTOFFS_H" $?
TMP=$(median $FILE_NAME 4 $i)
echo "#define MP_DEFAULT_TOOM_SQR_CUTOFF $TMP"
echo "#define MP_DEFAULT_TOOM_SQR_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(tc3s) Appending to $TOMMATH_CUTOFFS_H" $?

echo "#define MP_DEFAULT_SQR_TOOM_CUTOFF $TMP"
echo "#define MP_DEFAULT_SQR_TOOM_CUTOFF $TMP" >> $TOMMATH_CUTOFFS_H || die "(tc3s) Appending to $TOMMATH_CUTOFFS_H" $?
5 changes: 2 additions & 3 deletions helper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ sub check_source {
push @{$troubles->{unwanted_calloc}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bcalloc\s*\(/;
push @{$troubles->{unwanted_free}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bfree\s*\(/;
# and we probably want to also avoid the following
push @{$troubles->{unwanted_memcpy}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemcpy\s*\(/;
push @{$troubles->{unwanted_memset}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemset\s*\(/;
push @{$troubles->{unwanted_memcpy}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemcpy\s*\(/;
push @{$troubles->{unwanted_memcpy}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemcpy\s*\(/ && $file !~ /s_mp_copy_digs.c/;
push @{$troubles->{unwanted_memset}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemset\s*\(/ && $file !~ /s_mp_zero_buf.c/ && $file !~ /s_mp_zero_digs.c/;
push @{$troubles->{unwanted_memmove}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemmove\s*\(/;
push @{$troubles->{unwanted_memcmp}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bmemcmp\s*\(/;
push @{$troubles->{unwanted_strcmp}}, $lineno if $file =~ /^[^\/]+\.c$/ && $l =~ /\bstrcmp\s*\(/;
Expand Down
Loading