Skip to content

Commit

Permalink
Merge branch 'develop' into feature-detection2
Browse files Browse the repository at this point in the history
  • Loading branch information
minad authored Jun 7, 2019
2 parents f769d66 + f109772 commit 6987dba
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 31 deletions.
6 changes: 4 additions & 2 deletions demo/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ static int test_mp_invmod(void)

}

#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559)
static int test_mp_set_double(void)
{
int i;
Expand All @@ -675,7 +676,6 @@ static int test_mp_set_double(void)
}

/* test mp_get_double/mp_set_double */
#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559)
if (mp_set_double(&a, +1.0/0.0) != MP_VAL) {
printf("\nmp_set_double should return MP_VAL for +inf");
goto LBL_ERR;
Expand Down Expand Up @@ -713,7 +713,6 @@ static int test_mp_set_double(void)
goto LBL_ERR;
}
}
#endif

mp_clear_multi(&a, &b, NULL);
return EXIT_SUCCESS;
Expand All @@ -722,6 +721,7 @@ static int test_mp_set_double(void)
return EXIT_FAILURE;

}
#endif

static int test_mp_get_u32(void)
{
Expand Down Expand Up @@ -2156,7 +2156,9 @@ int unit_tests(int argc, char **argv)
T(mp_read_radix),
T(mp_reduce_2k),
T(mp_reduce_2k_l),
#if defined(__STDC_IEC_559__) || defined(__GCC_IEC_559)
T(mp_set_double),
#endif
T(mp_signed_rsh),
T(mp_sqrt),
T(mp_sqrtmod_prime),
Expand Down
9 changes: 0 additions & 9 deletions generate_def.sh

This file was deleted.

31 changes: 25 additions & 6 deletions helper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,26 @@ sub update_dep
}

sub generate_def {
system("sh", "generate_def.sh");
my @files = split /\n/, `git ls-files`;
@files = grep(/\.c/, @files);
@files = map { my $x = $_; $x =~ s/^bn_|\.c$//g; $x; } @files;
@files = grep(!/mp_radix_smap/, @files);

@files = grep(!/conversion/, @files);
push(@files, qw(mp_set_i32 mp_set_i64 mp_set_u32 mp_set_u64 mp_set_int mp_set_long mp_set_long_long mp_get_i32 mp_get_i64 mp_get_mag32 mp_get_mag64 mp_get_int mp_get_long mp_get_long_long mp_init_i32 mp_init_i64 mp_init_u32 mp_init_u64 mp_init_set_int));

my $files = join("\n ", sort(grep(/^mp_/, @files)));
write_file "tommath.def", "; libtommath
;
; Use this command to produce a 32-bit .lib file, for use in any MSVC version
; lib -machine:X86 -name:libtommath.dll -def:tommath.def -out:tommath.lib
; Use this command to produce a 64-bit .lib file, for use in any MSVC version
; lib -machine:X64 -name:libtommath.dll -def:tommath.def -out:tommath.lib
;
EXPORTS
$files
";
return 0;
}

sub die_usage {
Expand All @@ -446,7 +465,7 @@ sub die_usage {
$0 -o OR $0 --check-comments
$0 -m OR $0 --check-makefiles
$0 -a OR $0 --check-all
$0 -u OR $0 --update-makefiles
$0 -u OR $0 --update-files
MARKER
}

Expand All @@ -455,7 +474,7 @@ sub die_usage {
"m|check-makefiles" => \my $check_makefiles,
"d|check-doc" => \my $check_doc,
"a|check-all" => \my $check_all,
"u|update-makefiles" => \my $update_makefiles,
"u|update-files" => \my $update_files,
"h|help" => \my $help
) or die_usage;

Expand All @@ -464,9 +483,9 @@ sub die_usage {
$failure ||= check_comments() if $check_all || $check_comments;
$failure ||= check_doc() if $check_doc; # temporarily excluded from --check-all
$failure ||= process_makefiles(0) if $check_all || $check_makefiles;
$failure ||= process_makefiles(1) if $update_makefiles;
$failure ||= update_dep() if $update_makefiles;
$failure ||= generate_def() if $update_makefiles;
$failure ||= process_makefiles(1) if $update_files;
$failure ||= update_dep() if $update_files;
$failure ||= generate_def() if $update_files;

die_usage unless defined $failure;
exit $failure ? 1 : 0;
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ zipup: clean astyle new_file manual poster docs
gpg -b -a ltm-$(VERSION).zip

new_file:
perl helper.pl --update-makefiles
perl helper.pl --update-files

perlcritic:
perlcritic *.pl doc/*.pl
Expand Down
4 changes: 2 additions & 2 deletions makefile.msvc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PREFIX = c:\devel
CFLAGS = /Ox

#Compilation flags
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /W3 $(CFLAGS)
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D__STDC_WANT_SECURE_LIB__=0 /Wall /wd4146 /wd4127 /wd4710 /wd4711 /wd4820 $(CFLAGS)
LTM_LDFLAGS = advapi32.lib

#Libraries to be created (this makefile builds only static libraries)
Expand Down Expand Up @@ -60,7 +60,7 @@ $(OBJECTS): $(HEADERS)
.c.obj:
$(CC) $(LTM_CFLAGS) /c $< /Fo$@

#Create tomcrypt.lib
#Create tommath.lib
$(LIBMAIN_S): $(OBJECTS)
lib /out:$(LIBMAIN_S) $(OBJECTS)

Expand Down
4 changes: 2 additions & 2 deletions testme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ if [[ "$CHECK_FORMAT" == "1" ]]
then
make astyle
_check_git "make astyle"
perl helper.pl --update-makefiles
_check_git "helper.pl --update-makefiles"
perl helper.pl --update-files
_check_git "helper.pl --update-files"
perl helper.pl --check-all
_check_git "helper.pl --check-all"
exit $?
Expand Down
17 changes: 8 additions & 9 deletions tommath.def
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ EXPORTS
mp_copy
mp_count_bits
mp_decr
mp_div
mp_div_2
mp_div_2d
mp_div_3
mp_div
mp_div_d
mp_dr_is_modulus
mp_dr_reduce
Expand Down Expand Up @@ -63,25 +63,25 @@ EXPORTS
mp_init_u32
mp_init_u64
mp_invmod
mp_is_square
mp_iseven
mp_isodd
mp_is_square
mp_kronecker
mp_lcm
mp_lshd
mp_mod_2d
mp_mod
mp_mod_2d
mp_mod_d
mp_montgomery_calc_normalization
mp_montgomery_reduce
mp_montgomery_setup
mp_mul
mp_mul_2
mp_mul_2d
mp_mul
mp_mul_d
mp_mulmod
mp_neg
mp_n_root
mp_neg
mp_or
mp_prime_fermat
mp_prime_frobenius_underwood
Expand All @@ -93,15 +93,14 @@ EXPORTS
mp_prime_strong_lucas_selfridge
mp_radix_size
mp_rand
mp_rand_digit
mp_read_radix
mp_read_signed_bin
mp_read_unsigned_bin
mp_reduce
mp_reduce_2k
mp_reduce_2k_l
mp_reduce_2k_setup
mp_reduce_2k_setup_l
mp_reduce
mp_reduce_is_2k
mp_reduce_is_2k_l
mp_reduce_setup
Expand All @@ -125,12 +124,12 @@ EXPORTS
mp_sub
mp_sub_d
mp_submod
mp_toradix
mp_toradix_n
mp_to_signed_bin
mp_to_signed_bin_n
mp_to_unsigned_bin
mp_to_unsigned_bin_n
mp_toradix
mp_toradix_n
mp_unsigned_bin_size
mp_xor
mp_zero

0 comments on commit 6987dba

Please sign in to comment.