Skip to content

Commit 5c5b6bf

Browse files
Jeffrey HurchallaJeffrey Hurchalla
authored andcommitted
merge changes
2 parents 1d733da + b3258ed commit 5c5b6bf

29 files changed

+2492
-722
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,18 @@ target_sources(hurchalla_factoring INTERFACE
7373
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/is_prime.h>
7474
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/resource_intensive_api/FactorByTable32.h>
7575
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/resource_intensive_api/factorize_intensive_uint32.h>
76-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/resource_intensive_api/IsPrimeIntensive.h>
76+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/resource_intensive_api/is_prime_intensive.h>
77+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/resource_intensive_api/IsPrimeTable.h>
78+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/resource_intensive_api/is_prime_ultimate.h>
7779
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/DualMontgomeryForm.h>
7880
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/FactorizeStage2.h>
7981
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/factorize_trialdivision.h>
8082
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/factorize_wheel210.h>
8183
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/impl_factorize.h>
8284
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/impl_greatest_common_divisor.h>
8385
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/impl_is_prime.h>
86+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/impl_is_prime_intensive.h>
8487
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/ImplFactorByTable32.h>
85-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/ImplIsPrimeIntensive.h>
8688
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/is_prime_bruteforce.h>
8789
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/is_prime_miller_rabin.h>
8890
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/hurchalla/factoring/detail/is_prime_trialdivision.h>

build_tests.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Copyright (c) 2020-2024 Jeffrey Hurchalla.
3+
# Copyright (c) 2020-2025 Jeffrey Hurchalla.
44
# This Source Code Form is subject to the terms of the Mozilla Public
55
# License, v. 2.0. If a copy of the MPL was not distributed with this
66
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
@@ -11,7 +11,7 @@
1111
# Description of this script -----------
1212
# This is a working convenience script for invoking the testing builds and then
1313
# running the tests.
14-
# The syntax is
14+
# The syntax is
1515
# ./build_tests [-c<compiler_name>] [-j<num_jobs>] [-r] [-a] [-u] [-t] [-m<Release|Debug|Profile>] [-l<standard_library_name>]
1616
#
1717
# -c allows you to select the compiler, rather than using the default.
@@ -177,7 +177,6 @@ if [ "${BASH_VERSINFO:-0}" -lt 4 ]; then
177177
exit 1
178178
fi
179179

180-
181180
while getopts ":m:l:c:j:h-:raut" opt; do
182181
case $opt in
183182
h)
@@ -541,7 +540,7 @@ if [ "${mode,,}" = "release" ]; then
541540
$gcc_static_analysis" "${clang_static_analysis[@]}" \
542541
$cmake_cpp_compiler $cmake_c_compiler
543542
exit_on_failure
544-
cmake --build ./$build_dir --config Release
543+
cmake --build ./$build_dir $num_jobs --config Release
545544
exit_on_failure
546545
popd > /dev/null 2>&1
547546
elif [ "${mode,,}" = "debug" ]; then
@@ -558,7 +557,7 @@ elif [ "${mode,,}" = "debug" ]; then
558557
$gcc_static_analysis" "${clang_static_analysis[@]}" \
559558
$cmake_cpp_compiler $cmake_c_compiler
560559
exit_on_failure
561-
cmake --build ./$build_dir --config Debug
560+
cmake --build ./$build_dir $num_jobs --config Debug
562561
exit_on_failure
563562
popd > /dev/null 2>&1
564563
elif [ "${mode,,}" = "profile" ]; then
@@ -573,7 +572,7 @@ elif [ "${mode,,}" = "profile" ]; then
573572
$use_inline_asm $use_all_inline_asm" \
574573
$cmake_cpp_compiler $cmake_c_compiler
575574
exit_on_failure
576-
cmake --build ./$build_dir --config RelWithDebInfo
575+
cmake --build ./$build_dir $num_jobs --config RelWithDebInfo
577576
exit_on_failure
578577
popd > /dev/null 2>&1
579578
else

include/hurchalla/factoring/detail/ImplFactorByTable32.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <fstream>
1717
#include <exception>
1818
#include <type_traits>
19+
#include <limits>
1920

2021
namespace hurchalla { namespace detail {
2122

@@ -228,10 +229,12 @@ class ImplFactorByTable32
228229
for (std::size_t j=1; j<size_wheel_divs; ++j) {
229230
std::uint64_t wd = wheel_divs[j];
230231
std::uint64_t two_wd = wd + wd;
231-
odd_coprime_sieve[wd/2] = 0;
232+
odd_coprime_sieve[static_cast<std::size_t>(wd/2)] = 0;
232233
for (std::uint64_t i=wd*wd; i<wheel_size; i+=two_wd) {
233234
HPBC_CONSTEXPR_ASSERT(i/2 < half_wheel_size);
234-
odd_coprime_sieve[i/2] = 0;
235+
static_assert((wheel_size-1)/2 <=
236+
std::numeric_limits<std::size_t>::max());
237+
odd_coprime_sieve[static_cast<std::size_t>(i/2)] = 0;
235238
}
236239
}
237240

include/hurchalla/factoring/detail/ImplIsPrimeIntensive.h

Lines changed: 0 additions & 258 deletions
This file was deleted.

include/hurchalla/factoring/detail/IsPrimeFactor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typename std::enable_if<
4141
(ut_numeric_limits<typename MontType::IntegerType>::digits==128), bool>::type
4242
operator()(const MontType& mf) const
4343
{
44-
return is_prime_miller_rabin::call(mf);
44+
return is_prime_miller_rabin::call_mont(mf);
4545
}
4646

4747

0 commit comments

Comments
 (0)