Repository: ckormanyos/wide-integer
Branch: master
Commit: 3922df20c64c
Files: 95
Total size: 1.3 MB
Directory structure:
gitextract_cm9ct4p2/
├── .clang-tidy
├── .gcov/
│ └── make/
│ ├── make_gcov_01_generic.gmk
│ ├── make_gcov_02_files.gmk
│ └── make_gcov_03_flags.gmk
├── .github/
│ ├── toolchains/
│ │ └── gcc.cmake
│ └── workflows/
│ ├── CodeQL.yml
│ ├── wide_integer.yml
│ ├── wide_integer_codecov.yml
│ ├── wide_integer_fuzzing.yml
│ └── wide_integer_sonar.yml
├── .gitignore
├── .props/
│ └── Directory.Build.props
├── .tidy/
│ └── make/
│ ├── make_tidy_01_generic.gmk
│ ├── make_tidy_02_files.gmk
│ └── make_tidy_03_flags.gmk
├── CMakeLists.txt
├── LICENSE_1_0.txt
├── Makefile
├── README.md
├── boost/
│ └── multiprecision/
│ └── uintwide_t_backend.hpp
├── codecov.yml
├── examples/
│ ├── CMakeLists.txt
│ ├── build/
│ │ └── test_examples.sh
│ ├── example000_numeric_limits.cpp
│ ├── example000a_builtin_convert.cpp
│ ├── example001_mul_div.cpp
│ ├── example001a_div_mod.cpp
│ ├── example002_shl_shr.cpp
│ ├── example003_sqrt.cpp
│ ├── example003a_cbrt.cpp
│ ├── example004_rootk_pow.cpp
│ ├── example005_powm.cpp
│ ├── example005a_pow_factors_of_p99.cpp
│ ├── example006_gcd.cpp
│ ├── example007_random_generator.cpp
│ ├── example008_miller_rabin_prime.cpp
│ ├── example008a_miller_rabin_prime.cpp
│ ├── example008b_solovay_strassen_prime.cpp
│ ├── example009_timed_mul.cpp
│ ├── example009a_timed_mul_4_by_4.cpp
│ ├── example009b_timed_mul_8_by_8.cpp
│ ├── example010_uint48_t.cpp
│ ├── example011_uint24_t.cpp
│ ├── example012_rsa_crypto.cpp
│ ├── example013_ecdsa_sign_verify.cpp
│ ├── example014_pi_spigot_wide.cpp
│ └── example_uintwide_t.h
├── math/
│ └── wide_integer/
│ ├── cpp.hint
│ └── uintwide_t.h
├── run_fuzzing.sh
├── sonar-project.properties
├── target/
│ ├── build/
│ │ └── test_examples_emulator.gdb
│ └── micros/
│ └── stm32f429/
│ └── make/
│ ├── single/
│ │ └── crt.cpp
│ └── stm32f429.ld
├── test/
│ ├── CMakeLists.txt
│ ├── coverity.c
│ ├── fuzzing/
│ │ ├── test_fuzzing_add.cpp
│ │ ├── test_fuzzing_div.cpp
│ │ ├── test_fuzzing_div_versus_cppalliance_int128.cpp
│ │ ├── test_fuzzing_mul.cpp
│ │ ├── test_fuzzing_powm.cpp
│ │ ├── test_fuzzing_prime.cpp
│ │ ├── test_fuzzing_sdiv.cpp
│ │ ├── test_fuzzing_sqrt.cpp
│ │ └── test_fuzzing_sub.cpp
│ ├── parallel_for.h
│ ├── stopwatch.h
│ ├── test.cpp
│ ├── test.hpp
│ ├── test_arithmetic.hpp
│ ├── test_uintwide_t.h
│ ├── test_uintwide_t_boost_backend.cpp
│ ├── test_uintwide_t_boost_backend_via_test_arithmetic.cpp
│ ├── test_uintwide_t_edge_cases.cpp
│ ├── test_uintwide_t_examples.cpp
│ ├── test_uintwide_t_float_convert.cpp
│ ├── test_uintwide_t_int_convert.cpp
│ ├── test_uintwide_t_n_base.cpp
│ ├── test_uintwide_t_n_base.h
│ ├── test_uintwide_t_n_binary_ops_base.cpp
│ ├── test_uintwide_t_n_binary_ops_base.h
│ ├── test_uintwide_t_n_binary_ops_mul_div_4_by_4_template.h
│ ├── test_uintwide_t_n_binary_ops_mul_n_by_m_template.h
│ ├── test_uintwide_t_n_binary_ops_template.h
│ ├── test_uintwide_t_n_binary_ops_template_signed.h
│ ├── test_uintwide_t_n_number_theory_funcs_template.h
│ ├── test_uintwide_t_spot_values.cpp
│ └── test_uintwide_t_xtra_from_issue_335.cpp
├── util/
│ └── utility/
│ └── util_pseudorandom_time_point_seed.h
├── wide_integer.sln
├── wide_integer.vcxproj
├── wide_integer.vcxproj.filters
├── wide_integer_vs2022.sln
├── wide_integer_vs2022.vcxproj
└── wide_integer_vs2022.vcxproj.filters
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-tidy
================================================
---
Checks: >
*,
-altera-struct-pack-align,
-altera-unroll-loops,
-fuchsia-*,
-llvmlibc-*
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
FormatStyle: none
User: john
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
# because _impl isn't technically lower_case
# - key: readability-identifier-naming.NamespaceCase
# value: lower_case
- key: readability-identifier-naming.InlineNamespaceCase
value: lower_case
- key: readability-identifier-naming.EnumConstantCase
value: lower_case
# - key: readability-identifier-naming.ConstexprVariableCase
# value: lower_case
- key: readability-identifier-naming.ConstantMemberCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberCase
value: lower_case
- key: readability-identifier-naming.ProtectedMemberCase
value: lower_case
- key: readability-identifier-naming.PublicMemberCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
# - key: readability-identifier-naming.ClassConstantCase
# value: lower_case
# - key: readability-identifier-naming.ClassMemberCase
# value: lower_case
# - key: readability-identifier-naming.GlobalConstantCase
# value: lower_case
- key: readability-identifier-naming.GlobalConstantPointerCase
value: lower_case
- key: readability-identifier-naming.GlobalPointerCase
value: lower_case
# - key: readability-identifier-naming.GlobalVariableCase
# value: lower_case
- key: readability-identifier-naming.LocalConstantCase
value: lower_case
- key: readability-identifier-naming.LocalConstantPointerCase
value: lower_case
- key: readability-identifier-naming.LocalPointerCase
value: lower_case
- key: readability-identifier-naming.LocalVariableCase
value: lower_case
- key: readability-identifier-naming.StaticConstantCase
value: lower_case
- key: readability-identifier-naming.StaticVariableCase
value: lower_case
# - key: readability-identifier-naming.ConstantCase
# value: lower_case
# - key: readability-identifier-naming.VariableCase
# value: lower_case
- key: readability-identifier-naming.ConstantParameterCase
value: lower_case
- key: readability-identifier-naming.ParameterPackCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.PointerParameterCase
value: lower_case
- key: readability-identifier-naming.ConstantPointerParameterCase
value: lower_case
- key: readability-identifier-naming.AbstractClassCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: lower_case
- key: readability-identifier-naming.UnionCase
value: lower_case
- key: readability-identifier-naming.EnumCase
value: lower_case
- key: readability-identifier-naming.GlobalFunctionCase
value: lower_case
# - key: readability-identifier-naming.ConstexprFunctionCase
# value: lower_case
- key: readability-identifier-naming.FunctionCase
value: lower_case
# - key: readability-identifier-naming.ConstexprMethodCase
# value: lower_case
- key: readability-identifier-naming.VirtualMethodCase
value: lower_case
# - key: readability-identifier-naming.ClassMethodCase
# value: lower_case
- key: readability-identifier-naming.PrivateMethodCase
value: lower_case
- key: readability-identifier-naming.ProtectedMethodCase
value: lower_case
- key: readability-identifier-naming.PublicMethodCase
value: lower_case
- key: readability-identifier-naming.MethodCase
value: lower_case
- key: readability-identifier-naming.TypedefCase
value: lower_case
# https://bugs.llvm.org/show_bug.cgi?id=46752
# - key: readability-identifier-naming.TypeTemplateParameterCase
# value: CamelCase
- key: readability-identifier-naming.ValueTemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TemplateTemplateParameterCase
value: CamelCase
# https://bugs.llvm.org/show_bug.cgi?id=46752
# - key: readability-identifier-naming.TemplateParameterCase
# value: CamelCase
- key: readability-identifier-naming.TypeAliasCase
value: lower_case
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.ObjcIvarCase
value: lower_case
- key: readability-identifier-naming.NamespacePrefix
value: ''
- key: readability-identifier-naming.InlineNamespacePrefix
value: ''
- key: readability-identifier-naming.EnumConstantPrefix
value: ''
- key: readability-identifier-naming.ConstexprVariablePrefix
value: ''
- key: readability-identifier-naming.ConstantMemberPrefix
value: ''
- key: readability-identifier-naming.PrivateMemberPrefix
value: '_'
- key: readability-identifier-naming.ProtectedMemberPrefix
value: '_'
- key: readability-identifier-naming.PublicMemberPrefix
value: ''
- key: readability-identifier-naming.MemberPrefix
value: ''
- key: readability-identifier-naming.ClassConstantPrefix
value: ''
- key: readability-identifier-naming.ClassMemberPrefix
value: ''
- key: readability-identifier-naming.GlobalConstantPrefix
value: ''
- key: readability-identifier-naming.GlobalConstantPointerPrefix
value: ''
- key: readability-identifier-naming.GlobalPointerPrefix
value: ''
- key: readability-identifier-naming.GlobalVariablePrefix
value: ''
- key: readability-identifier-naming.LocalConstantPrefix
value: ''
- key: readability-identifier-naming.LocalConstantPointerPrefix
value: ''
- key: readability-identifier-naming.LocalPointerPrefix
value: ''
- key: readability-identifier-naming.LocalVariablePrefix
value: ''
- key: readability-identifier-naming.StaticConstantPrefix
value: ''
- key: readability-identifier-naming.StaticVariablePrefix
value: ''
- key: readability-identifier-naming.ConstantPrefix
value: ''
- key: readability-identifier-naming.VariablePrefix
value: ''
- key: readability-identifier-naming.ConstantParameterPrefix
value: ''
- key: readability-identifier-naming.ParameterPackPrefix
value: ''
- key: readability-identifier-naming.ParameterPrefix
value: ''
- key: readability-identifier-naming.PointerParameterPrefix
value: ''
- key: readability-identifier-naming.ConstantPointerParameterPrefix
value: ''
- key: readability-identifier-naming.AbstractClassPrefix
value: ''
- key: readability-identifier-naming.StructPrefix
value: ''
- key: readability-identifier-naming.ClassPrefix
value: ''
- key: readability-identifier-naming.UnionPrefix
value: ''
- key: readability-identifier-naming.EnumPrefix
value: ''
- key: readability-identifier-naming.GlobalFunctionPrefix
value: ''
- key: readability-identifier-naming.ConstexprFunctionPrefix
value: ''
- key: readability-identifier-naming.FunctionPrefix
value: ''
- key: readability-identifier-naming.ConstexprMethodPrefix
value: ''
- key: readability-identifier-naming.VirtualMethodPrefix
value: ''
- key: readability-identifier-naming.ClassMethodPrefix
value: ''
- key: readability-identifier-naming.PrivateMethodPrefix
value: ''
- key: readability-identifier-naming.ProtectedMethodPrefix
value: ''
- key: readability-identifier-naming.PublicMethodPrefix
value: ''
- key: readability-identifier-naming.MethodPrefix
value: ''
- key: readability-identifier-naming.TypedefPrefix
value: ''
- key: readability-identifier-naming.TypeTemplateParameterPrefix
value: ''
- key: readability-identifier-naming.ValueTemplateParameterPrefix
value: ''
- key: readability-identifier-naming.TemplateTemplateParameterPrefix
value: ''
- key: readability-identifier-naming.TemplateParameterPrefix
value: ''
- key: readability-identifier-naming.TypeAliasPrefix
value: ''
- key: readability-identifier-naming.MacroDefinitionPrefix
value: ''
- key: readability-identifier-naming.ObjcIvarPrefix
value: ''
- key: readability-identifier-naming.NamespaceSuffix
value: ''
- key: readability-identifier-naming.InlineNamespaceSuffix
value: ''
- key: readability-identifier-naming.EnumConstantSuffix
value: ''
- key: readability-identifier-naming.ConstexprVariableSuffix
value: ''
- key: readability-identifier-naming.ConstantMemberSuffix
value: ''
- key: readability-identifier-naming.PrivateMemberSuffix
value: ''
- key: readability-identifier-naming.ProtectedMemberSuffix
value: ''
- key: readability-identifier-naming.PublicMemberSuffix
value: ''
- key: readability-identifier-naming.MemberSuffix
value: ''
- key: readability-identifier-naming.ClassConstantSuffix
value: ''
- key: readability-identifier-naming.ClassMemberSuffix
value: ''
- key: readability-identifier-naming.GlobalConstantSuffix
value: ''
- key: readability-identifier-naming.GlobalConstantPointerSuffix
value: ''
- key: readability-identifier-naming.GlobalPointerSuffix
value: ''
- key: readability-identifier-naming.GlobalVariableSuffix
value: ''
- key: readability-identifier-naming.LocalConstantSuffix
value: ''
- key: readability-identifier-naming.LocalConstantPointerSuffix
value: ''
- key: readability-identifier-naming.LocalPointerSuffix
value: ''
- key: readability-identifier-naming.LocalVariableSuffix
value: ''
- key: readability-identifier-naming.StaticConstantSuffix
value: ''
- key: readability-identifier-naming.StaticVariableSuffix
value: ''
- key: readability-identifier-naming.ConstantSuffix
value: ''
- key: readability-identifier-naming.VariableSuffix
value: ''
- key: readability-identifier-naming.ConstantParameterSuffix
value: ''
- key: readability-identifier-naming.ParameterPackSuffix
value: ''
- key: readability-identifier-naming.ParameterSuffix
value: ''
- key: readability-identifier-naming.PointerParameterSuffix
value: ''
- key: readability-identifier-naming.ConstantPointerParameterSuffix
value: ''
- key: readability-identifier-naming.AbstractClassSuffix
value: ''
- key: readability-identifier-naming.StructSuffix
value: ''
- key: readability-identifier-naming.ClassSuffix
value: ''
- key: readability-identifier-naming.UnionSuffix
value: ''
- key: readability-identifier-naming.EnumSuffix
value: ''
- key: readability-identifier-naming.GlobalFunctionSuffix
value: ''
- key: readability-identifier-naming.ConstexprFunctionSuffix
value: ''
- key: readability-identifier-naming.FunctionSuffix
value: ''
- key: readability-identifier-naming.ConstexprMethodSuffix
value: ''
- key: readability-identifier-naming.VirtualMethodSuffix
value: ''
- key: readability-identifier-naming.ClassMethodSuffix
value: ''
- key: readability-identifier-naming.PrivateMethodSuffix
value: ''
- key: readability-identifier-naming.ProtectedMethodSuffix
value: ''
- key: readability-identifier-naming.PublicMethodSuffix
value: ''
- key: readability-identifier-naming.MethodSuffix
value: ''
- key: readability-identifier-naming.TypedefSuffix
value: ''
- key: readability-identifier-naming.TypeTemplateParameterSuffix
value: ''
- key: readability-identifier-naming.ValueTemplateParameterSuffix
value: ''
- key: readability-identifier-naming.TemplateTemplateParameterSuffix
value: ''
- key: readability-identifier-naming.TemplateParameterSuffix
value: ''
- key: readability-identifier-naming.TypeAliasSuffix
value: ''
- key: readability-identifier-naming.MacroDefinitionSuffix
value: ''
- key: readability-identifier-naming.ObjcIvarSuffix
value: ''
...
================================================
FILE: .gcov/make/make_gcov_01_generic.gmk
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2025.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
PATH_MAKE = $(CURDIR)
PATH_PRJ = $(PATH_MAKE)/../..
PATH_SRC = $(PATH_PRJ)
PATH_BIN = $(PATH_MAKE)/bin
PATH_ERR = $(PATH_MAKE)/err
PATH_OBJ = $(PATH_MAKE)/obj
CAT = cat
GNUECHO = echo
LS = ls
MKDIR = mkdir
GCOV = gcov
LCOV = lcov
GENHTML = genhtml
RM = rm
SED = sed
include make_gcov_02_files.gmk
include make_gcov_03_flags.gmk
FILES_ALL = $(FILES_PRJ)
FILES_O = $(addprefix $(PATH_OBJ)/, $(notdir $(addsuffix .o, $(FILES_ALL))))
FILES_GCOV = $(addprefix $(PATH_OBJ)/, $(notdir $(addsuffix .gcov, $(FILES_ALL))))
# ------------------------------------------------------------------------------
# VPATH definition: VPATH is required for make to find the source files.
# ------------------------------------------------------------------------------
VPATH := $(sort $(dir $(FILES_ALL)))
# ------------------------------------------------------------------------------
# Executable file:
# ------------------------------------------------------------------------------
.PHONY: $(PATH_BIN)/wide_integer.exe
$(PATH_BIN)/wide_integer.exe: $(FILES_O)
# Link coverage-instrumented executable
@$(GNUECHO) +++ link object files to $(PATH_BIN)/wide_integer.exe
@$(CC) -x none $(CXXFLAGS) $(FILES_O) -o $(PATH_BIN)/wide_integer.exe
@$(GNUECHO)
# ------------------------------------------------------------------------------
# Main dependency:
# Compile all files and link them.
# Run gcov and get results.
# (See also https://github.com/codecov/example-cpp11-cmake)
# ------------------------------------------------------------------------------
.PHONY: gcov
gcov: $(PATH_BIN)/wide_integer.exe
# Obtain results
@$(GNUECHO) +++ execute $(PATH_BIN)/wide_integer.exe
@$(PATH_BIN)/wide_integer.exe
@$(GNUECHO)
@$(GNUECHO) +++ running gcov
@$(GCOV) $(GCOV_FLAGS) $(addsuffix .cpp,$(FILES_PRJ))
@$(GNUECHO)
@$(GNUECHO) +++ running lcov
@$(LCOV) $(LCOV_BRANCH) -c --directory obj --output-file coverage_unfiltered.info
@$(LCOV) $(LCOV_BRANCH) --remove coverage_unfiltered.info $(LCOV_REMOVES) --output-file coverage.info
@$(GNUECHO)
@$(GNUECHO) +++ running genhtml
@$(GENHTML) coverage.info $(LCOV_BRANCH) --demangle-cpp --output-directory $(PATH_BIN)/report
@$(GNUECHO)
# ------------------------------------------------------------------------------
# Clean temporary files.
# ------------------------------------------------------------------------------
.PHONY: clean
clean:
# creating output directories
@$(GNUECHO) +++ cleaning output directories
@-$(RM) -rf $(PATH_BIN)* || uname -r
@-$(RM) -rf $(PATH_ERR)* || uname -r
@-$(RM) -rf $(PATH_OBJ)* || uname -r
@-$(RM) -f *.gcov || uname -r
@-$(RM) -f coverage* || uname -r
@$(GNUECHO)
# ------------------------------------------------------------------------------
# Prepare the gcov build.
# ------------------------------------------------------------------------------
.PHONY: prepare
prepare: clean
@$(GNUECHO) +++ creating output directories
@-$(MKDIR) -p $(PATH_BIN)
@-$(MKDIR) -p $(PATH_ERR)
@-$(MKDIR) -p $(PATH_OBJ)
@$(GNUECHO)
@$(GNUECHO) +++ print gcov version
@$(GCOV) --version
@$(GNUECHO)
@$(GNUECHO) +++ print include paths
@$(GNUECHO) $(C_INCLUDES)
@$(GNUECHO)
# ------------------------------------------------------------------------------
# pattern rule for compilation of cpp-files
# ------------------------------------------------------------------------------
$(PATH_OBJ)/%.o : %.cpp
@-$(GNUECHO) +++ compiling: $(notdir $<) to $(notdir $(PATH_OBJ)/$(basename $(@F)).o)
@-$(CC) $(CXXFLAGS) -x c++ -c $(C_INCLUDES) $(C_DEFINES) $< -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err
@-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err
================================================
FILE: .gcov/make/make_gcov_02_files.gmk
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
FILES_PRJ = $(PATH_SRC)/test/test \
$(PATH_SRC)/test/test_uintwide_t_boost_backend \
$(PATH_SRC)/test/test_uintwide_t_edge_cases \
$(PATH_SRC)/test/test_uintwide_t_examples \
$(PATH_SRC)/test/test_uintwide_t_float_convert \
$(PATH_SRC)/test/test_uintwide_t_int_convert \
$(PATH_SRC)/test/test_uintwide_t_n_base \
$(PATH_SRC)/test/test_uintwide_t_n_binary_ops_base \
$(PATH_SRC)/test/test_uintwide_t_spot_values \
$(PATH_SRC)/examples/example000a_builtin_convert \
$(PATH_SRC)/examples/example000_numeric_limits \
$(PATH_SRC)/examples/example001_mul_div \
$(PATH_SRC)/examples/example001a_div_mod \
$(PATH_SRC)/examples/example002_shl_shr \
$(PATH_SRC)/examples/example003_sqrt \
$(PATH_SRC)/examples/example003a_cbrt \
$(PATH_SRC)/examples/example004_rootk_pow \
$(PATH_SRC)/examples/example005_powm \
$(PATH_SRC)/examples/example005a_pow_factors_of_p99 \
$(PATH_SRC)/examples/example006_gcd \
$(PATH_SRC)/examples/example007_random_generator \
$(PATH_SRC)/examples/example008_miller_rabin_prime \
$(PATH_SRC)/examples/example008a_miller_rabin_prime \
$(PATH_SRC)/examples/example008b_solovay_strassen_prime \
$(PATH_SRC)/examples/example009_timed_mul \
$(PATH_SRC)/examples/example009a_timed_mul_4_by_4 \
$(PATH_SRC)/examples/example009b_timed_mul_8_by_8 \
$(PATH_SRC)/examples/example010_uint48_t \
$(PATH_SRC)/examples/example011_uint24_t \
$(PATH_SRC)/examples/example012_rsa_crypto \
$(PATH_SRC)/examples/example013_ecdsa_sign_verify \
$(PATH_SRC)/examples/example014_pi_spigot_wide
================================================
FILE: .gcov/make/make_gcov_03_flags.gmk
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
BOOST_ROOT_FOR_GCOV = /mnt/c/boost/boost_1_90_0
CC = g++
STD = c++14
ALL_COV = 0
ifneq ($(MY_BOOST_ROOT),)
BOOST_ROOT_FOR_GCOV := $(MY_BOOST_ROOT)
endif
ifneq ($(MY_CC),)
CC := $(MY_CC)
endif
ifneq ($(MY_STD),)
STD := $(MY_STD)
endif
ifneq ($(MY_STD),)
STD := $(MY_STD)
endif
ifneq ($(MY_ALL_COV),)
ALL_COV := $(MY_ALL_COV)
endif
CXXFLAGS = -march=native \
-mtune=native \
-O2 \
-Wall \
-Wextra \
-Wconversion \
-Wsign-conversion \
-std=$(STD) \
-pthread \
-lpthread \
-fno-inline-functions \
-fprofile-arcs \
-ftest-coverage
C_DEFINES = WIDE_INTEGER_HAS_COVERAGE \
WIDE_INTEGER_HAS_LIMB_TYPE_UINT64 \
WIDE_INTEGER_HAS_MUL_8_BY_8_UNROLL
C_INCLUDES = $(PATH_SRC) \
$(BOOST_ROOT_FOR_GCOV)
C_DEFINES :=$(addprefix -D,$(C_DEFINES))
C_INCLUDES :=$(addprefix -I,$(C_INCLUDES))
GCOV_FLAGS = --object-directory obj \
--demangled-names
# ------------------------------------------------------------------------------
# All gcov flags: The GCOV_FLAGS below are equivalent to -abcfu
# ------------------------------------------------------------------------------
ifneq ($(ALL_COV),0)
GCOV_FLAGS := $(GCOV_FLAGS) \
--all-blocks \
--branch-counts \
--branch-probabilities \
--function-summaries \
--unconditional-branches
endif
LCOV_BRANCH =
ifneq ($(ALL_COV),0)
LCOV_BRANCH := --rc lcov_branch_coverage=1
endif
LCOV_REMOVES = '/usr/*' \
'*boost/*'
================================================
FILE: .github/toolchains/gcc.cmake
================================================
set(CMAKE_CXX_FLAGS_INIT "-Wall -Wconversion -Werror -Wextra -Wno-psabi -Wpedantic -Wshadow -Wundef")
================================================
FILE: .github/workflows/CodeQL.yml
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
name: CodeQL
on:
push:
branches:
- '**'
pull_request:
types: [opened, synchronize, reopened]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ cpp ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: Configure (cpp)
if: ${{ matrix.language == 'cpp' }}
run: echo configure_command_empty
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Build cpp
if: ${{ matrix.language == 'cpp' }}
run: |
echo 'build application on the command line'
g++ -fno-exceptions -fno-rtti -finline-functions -m64 -O2 -Werror -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=c++14 -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
================================================
FILE: .github/workflows/wide_integer.yml
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2020 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
name: wide_integer
on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '5 2 * * *' # run at 2:05 AM UTC
jobs:
cmake-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [ g++, clang++ ]
include:
- compiler: g++
clang_tidy: ""
container: johnmcfarlane/cnl_ci:gcc-11
- compiler: clang++
clang_tidy: "clang-tidy"
container: johnmcfarlane/cnl_ci:clang-13-libcpp
container: ${{matrix.container}}
steps:
- uses: actions/checkout@v6
- name: create build directory
run: mkdir $GITHUB_WORKSPACE/build
- name: install Boost
run: |
apt-get update --quiet
apt-get install --no-install-recommends --quiet --yes libboost-dev
- name: build
working-directory: build
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_CLANG_TIDY="${{matrix.clang_tidy}}" \
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/.github/toolchains/gcc.cmake \
-GNinja \
$GITHUB_WORKSPACE
cmake --build .
- name: test
working-directory: build
run: ctest --verbose --output-on-failure
cmake-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: clone-boost-develop
working-directory: ${{runner.workspace}}
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ${{runner.workspace}}/boost-root
- name: clone-submods
working-directory: ${{runner.workspace}}/boost-root
run: |
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.4
- name: bootstrap-boost
working-directory: ${{runner.workspace}}/boost-root
run: |
./bootstrap.bat
./b2 headers
- name: create build directory
run: mkdir ${{runner.workspace}}/build
- name: build
shell: cmd
working-directory: ${{runner.workspace}}/build
run: |
set BOOST_ROOT=${{runner.workspace}}\boost-root
cmake -DCMAKE_CXX_FLAGS="/W4 /WX /EHsc" -DCMAKE_CXX_STANDARD=20 ..\wide-integer
cmake --build . --config Release
- name: test
working-directory: ${{runner.workspace}}/build
run: ctest --verbose --output-on-failure
gnumake-clang-tidy-native:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install clang clang-tidy
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gnumake-clang-tidy-native
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
cd .tidy/make
echo "running clang-tidy"
echo "make prepare -f make_tidy_01_generic.gmk MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
echo
make prepare -f make_tidy_01_generic.gmk MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo "make tidy -f make_tidy_01_generic.gmk --jobs=8 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
make tidy -f make_tidy_01_generic.gmk --jobs=8 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo
echo "verify empty word count of ./tmp/all.tidy_txt"
wc ./tmp/all.tidy_txt | grep '0 0 0'
gcc-clang-native:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20, c++23 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile and link to ./wide_integer via Makefile"
${{ matrix.compiler }} -v
make MY_STD=${{ matrix.standard }} MY_CC=${{ matrix.compiler }} MY_BOOST_ROOT=../boost-root all
echo "ls ./wide_integer"
ls -la ./wide_integer
./wide_integer
gcc-clang-native-limb_type_uint64_t:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ gnu++14, gnu++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-limb_type_uint64_t
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -DWIDE_INTEGER_HAS_MUL_8_BY_8_UNROLL -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
./wide_integer.exe
gcc-clang-wide_integer_namespace:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-wide_integer_namespace
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_NAMESPACE=ckormanyos -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
./wide_integer.exe
gcc-clang-native-asan:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-asan
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -fno-exceptions -fno-rtti -fsanitize=address -fsanitize=leak -m64 -O1 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
setarch `uname -m` -R ./wide_integer.exe
gcc-clang-native-asan-clz:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-asan-clz
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -fno-exceptions -fno-rtti -fsanitize=address -fsanitize=leak -m64 -O1 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=c++14 -DWIDE_INTEGER_HAS_CLZ_LIMB_OPTIMIZATIONS -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
setarch `uname -m` -R ./wide_integer.exe
gcc-clang-native-ubsan:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-ubsan
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -fsanitize=shift -fsanitize=shift-exponent -fsanitize=shift-base -fsanitize=integer-divide-by-zero -fsanitize=null -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=enum -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
./wide_integer.exe
gcc-clang-native-ubsan-limb_type_uint64_t:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ gnu++14, gnu++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-ubsan-limb_type_uint64_t
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -fsanitize=shift -fsanitize=shift-exponent -fsanitize=shift-base -fsanitize=integer-divide-by-zero -fsanitize=null -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=enum -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
./wide_integer.exe
gcc-clang-native-ubsan-clz:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-ubsan-clz
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -fsanitize=shift -fsanitize=shift-exponent -fsanitize=shift-base -fsanitize=integer-divide-by-zero -fsanitize=null -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=enum -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=c++14 -DWIDE_INTEGER_HAS_CLZ_LIMB_OPTIMIZATIONS -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
./wide_integer.exe
gcc-clang-native-tsan:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-native-tsan
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -fno-exceptions -fno-rtti -fsanitize=thread -m64 -O1 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
setarch `uname -m` -R ./wide_integer.exe
apple-gcc-clang-native:
runs-on: macos-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: apple-gcc-clang-native
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "compile ./wide_integer.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
echo "ls ./wide_integer.exe"
ls -la ./wide_integer.exe
./wide_integer.exe
msvc-release-x64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
- uses: actions/checkout@v6
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.2
- name: bootstrap-boost
working-directory: ${{ runner.workspace }}/boost-root
run: |
./bootstrap.bat
./b2 headers
- name: msvc-release-x64
shell: cmd
working-directory: ./
run: |
set INCLUDE=%cd%;%cd%\..\boost-root;%INCLUDE%
MSBuild -m wide_integer.sln -p:useenv=true -p:Configuration=Release -p:Platform=x64 /t:Rebuild
dir %cd%\x64\Release\wide_integer.exe
%cd%\x64\Release\wide_integer.exe
msvc-release-x64-vs2022:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: clone-boost-develop
working-directory: ${{ runner.workspace }}
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ${{ runner.workspace }}/boost-root
- name: clone-boost-submods
working-directory: ${{ runner.workspace }}/boost-root
run: |
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.4
- name: bootstrap-boost
working-directory: ${{ runner.workspace }}/boost-root
run: |
./bootstrap.bat
./b2 headers
- name: msvc-release-x64-vs2022
shell: cmd
working-directory: ./
run: |
set INCLUDE=%cd%
set INCLUDE=${{ runner.workspace }}\boost-root;%INCLUDE%
MSBuild -m wide_integer_vs2022.sln -p:useenv=true -p:Configuration=Release -p:Platform=x64 /t:Rebuild
dir %cd%\x64\Release\wide_integer_vs2022.exe
%cd%\x64\Release\wide_integer_vs2022.exe
msys2-winhost-x64:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
compiler: [ g++ ]
standard: [ c++14, c++20 ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: msys2-winhost-x64
working-directory: ./
run: |
echo compile ./wide_integer.exe
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -m64 -O3 -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
ls -la ./wide_integer.exe
./wide_integer.exe
cygwin-winhost-x64:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
compiler: [ g++ ]
standard: [ c++17, c++20 ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
- uses: cygwin/cygwin-install-action@master
with:
check-sig: false
site: https://ftp.fau.de/cygwin/
packages: gcc-core gcc-g++
- name: boost-bootstrap
run: bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root && ./bootstrap.sh'
- name: boost-generate-headers
run: bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE")/../boost-root && ./b2 headers'
- name: query-gcc-version
run: bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && echo print-compiler-version && ${{ matrix.compiler }} -v'
- name: wide-integer-compile
run: bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && ${{ matrix.compiler }} -finline-functions -m64 -O2 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe'
- name: wide-integer-run
run: bash -l -c 'cd $(cygpath -u "$GITHUB_WORKSPACE") && ./wide_integer.exe'
gcc-arm-none-eabi:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
example: [ example001_mul_div, example003_sqrt ]
standard: [ c++14 ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: update-tools
run: |
sudo apt update
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libncursesw5_6.3-2ubuntu0.1_amd64.deb
sudo apt install ./libncursesw5_6.3-2ubuntu0.1_amd64.deb
mkdir -p emu_env && cd emu_env
wget --no-check-certificate https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
tar -xf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
wget --no-check-certificate https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v8.2.6-1/xpack-qemu-arm-8.2.6-1-linux-x64.tar.gz
tar -xzf xpack-qemu-arm-8.2.6-1-linux-x64.tar.gz
working-directory: ./
- id: upcase_my_example
uses: ASzc/change-string-case-action@v6
with:
string: ${{ matrix.example }}
- name: build-example-stm32f429
run: |
PATH="${{ runner.workspace }}/wide-integer/emu_env/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin:$PATH"
echo 'Query arm-none-eabi-g++ version'
echo
arm-none-eabi-g++ -v
echo
mkdir -p bin
arm-none-eabi-g++ -std=${{ matrix.standard }} -Werror -Wall -Wextra -Wpedantic -Wpedantic -Wconversion -Wsign-conversion -O1 -g -gdwarf-2 -ffunction-sections -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I. -DWIDE_INTEGER_DISABLE_IOSTREAM -DWIDE_INTEGER_DISABLE_TO_STRING -DWIDE_INTEGER_DISABLE_TRIVIAL_COPY_AND_STD_LAYOUT_CHECKS -DWIDE_INTEGER_NAMESPACE=ckormanyos -DWIDE_INTEGER_STANDALONE_${{ steps.upcase_my_example.outputs.uppercase }} examples/${{ matrix.example }}.cpp ./target/micros/stm32f429/make/single/crt.cpp -nostartfiles -Wl,--gc-sections -Wl,-Map,./bin/${{ matrix.example }}.map -T ./target/micros/stm32f429/make/stm32f429.ld --specs=nano.specs --specs=nosys.specs -o ./bin/${{ matrix.example }}.elf
arm-none-eabi-objcopy ./bin/${{ matrix.example }}.elf -O ihex ./bin/${{ matrix.example }}.hex
ls -la ./bin/${{ matrix.example }}.elf ./bin/${{ matrix.example }}.hex ./bin/${{ matrix.example }}.map
working-directory: ./
- name: emulate-target stm32f429
run: |
PATH="${{ runner.workspace }}/wide-integer/emu_env/xpack-qemu-arm-8.2.6-1/bin:$PATH"
qemu-system-gnuarmeclipse --verbose --mcu STM32F429ZI --nographic --gdb tcp::9999 -d unimp,guest_errors &
sleep 2
working-directory: ./
- name: run-test-on-target
run: |
sleep 2
PATH="${{ runner.workspace }}/wide-integer/emu_env/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin:$PATH"
echo 'Run test on target'
echo
arm-none-eabi-gdb ./bin/${{ matrix.example }}.elf -x ./target/build/test_examples_emulator.gdb > ./${{ matrix.example }}.txt
cat ./${{ matrix.example }}.txt
echo
echo 'We will now grep for the right answer...'
grep 'value 0xF00DCAFE' ./${{ matrix.example }}.txt
working-directory: ./
gcc-avr:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
example: [ example001_mul_div, example003_sqrt ]
standard: [ c++14 ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install gcc-avr avr-libc
- name: clone-real-time-cpp
run: |
git clone -b master --depth 1 https://github.com/ckormanyos/real-time-cpp.git ../real-time-cpp-root
working-directory: ./
- id: upcase_my_example
uses: ASzc/change-string-case-action@v6
with:
string: ${{ matrix.example }}
- name: gcc-avr
run: |
mkdir bin
echo ${{ steps.upcase_my_example.outputs.uppercase }}
echo 'compile examples/${{ matrix.example }}.cpp with:'
echo 'avr-g++ -x c++ -std=${{ matrix.standard }} -Os -Werror -Wall -Wextra -Wpedantic -Wpedantic -Wmain -Wundef -Wconversion -Wsign-conversion -Wunused-parameter -Wuninitialized -Wmissing-declarations -Wshadow -Wunreachable-code -Wswitch-default -Wswitch-enum -Wcast-align -Wmissing-include-dirs -Winit-self -Wfloat-equal -Wdouble-promotion -mmcu=atmega328p -mrelax -finline-functions -finline-limit=32 -fsigned-char -g -gdwarf-2 -fno-exceptions -ffunction-sections -fdata-sections -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -Wzero-as-null-pointer-constant -I. -I../real-time-cpp-root/ref_app/src -I../real-time-cpp-root/ref_app/src/util/STL -DWIDE_INTEGER_DISABLE_IOSTREAM -DWIDE_INTEGER_DISABLE_TO_STRING -DWIDE_INTEGER_DISABLE_TRIVIAL_COPY_AND_STD_LAYOUT_CHECKS -DWIDE_INTEGER_DISABLE_IMPLEMENT_UTIL_DYNAMIC_ARRAY -DWIDE_INTEGER_NAMESPACE=ckormanyos -DWIDE_INTEGER_STANDALONE_${{ steps.upcase_my_example.outputs.uppercase }} examples/${{ matrix.example }}.cpp -Wl,--gc-sections -Wl,-Map,./bin/${{ matrix.example }}.map -o bin/${{ matrix.example }}.elf'
avr-g++ -x c++ -std=${{ matrix.standard }} -Os -Werror -Wall -Wextra -Wpedantic -Wpedantic -Wmain -Wundef -Wconversion -Wsign-conversion -Wunused-parameter -Wuninitialized -Wmissing-declarations -Wshadow -Wunreachable-code -Wswitch-default -Wswitch-enum -Wcast-align -Wmissing-include-dirs -Winit-self -Wfloat-equal -Wdouble-promotion -mmcu=atmega328p -mrelax -finline-functions -finline-limit=32 -fsigned-char -g -gdwarf-2 -fno-exceptions -ffunction-sections -fdata-sections -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -Wzero-as-null-pointer-constant -I. -I../real-time-cpp-root/ref_app/src -I../real-time-cpp-root/ref_app/src/util/STL -DWIDE_INTEGER_DISABLE_IOSTREAM -DWIDE_INTEGER_DISABLE_TO_STRING -DWIDE_INTEGER_DISABLE_TRIVIAL_COPY_AND_STD_LAYOUT_CHECKS -DWIDE_INTEGER_DISABLE_IMPLEMENT_UTIL_DYNAMIC_ARRAY -DWIDE_INTEGER_NAMESPACE=ckormanyos -DWIDE_INTEGER_STANDALONE_${{ steps.upcase_my_example.outputs.uppercase }} examples/${{ matrix.example }}.cpp -Wl,--gc-sections -Wl,-Map,./bin/${{ matrix.example }}.map -o bin/${{ matrix.example }}.elf
echo
echo 'run objcopy with:'
echo 'avr-objcopy bin/${{ matrix.example }}.elf -O ihex bin/${{ matrix.example }}.hex'
avr-objcopy bin/${{ matrix.example }}.elf -O ihex bin/${{ matrix.example }}.hex
echo
echo 'ls -la bin/${{ matrix.example }}.elf bin/${{ matrix.example }}.map bin/${{ matrix.example }}.hex'
ls -la bin/${{ matrix.example }}.elf bin/${{ matrix.example }}.map bin/${{ matrix.example }}.hex
working-directory: ./
gcc-clang-boost_backend:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14, c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/assert
git submodule update --init libs/config
git submodule update --init libs/core
git submodule update --init libs/math
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gcc-clang-boost_backend
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
echo "print compiler version"
${{ matrix.compiler }} -v
echo
echo "compile ./test_uintwide_t_boost_backend_via_test_arithmetic.exe"
${{ matrix.compiler }} -finline-functions -m64 -O2 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -I. -I../boost-root test/test_uintwide_t_boost_backend_via_test_arithmetic.cpp -o test_uintwide_t_boost_backend_via_test_arithmetic.exe
echo "ls -la ./test_uintwide_t_boost_backend_via_test_arithmetic.exe"
echo
echo "verify presence of ./test_uintwide_t_boost_backend_via_test_arithmetic.exe"
ls -la ./test_uintwide_t_boost_backend_via_test_arithmetic.exe
echo
echo "execute ./test_uintwide_t_boost_backend_via_test_arithmetic.exe"
./test_uintwide_t_boost_backend_via_test_arithmetic.exe
gcc-clang-xtra:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++20 ]
compiler: [ g++, clang++ ]
suite: [ test_uintwide_t_xtra_from_issue_335 ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: gcc-clang-xtra
run: |
echo "compile ./${{ matrix.suite }}.exe"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -finline-functions -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wshadow -Wundef -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=${{ matrix.standard }} -DWIDE_INTEGER_DISABLE_PRIVATE_CLASS_DATA_MEMBERS -DWIDE_INTEGER_NAMESPACE=ckormanyos -I. test/${{ matrix.suite }}.cpp -o ${{ matrix.suite }}.exe
ls -la ./${{ matrix.suite }}.exe
./${{ matrix.suite }}.exe
================================================
FILE: .github/workflows/wide_integer_codecov.yml
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
name: wide_integer_codecov
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
gnumake-gcc-gcov-native:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++14 ]
compiler: [ g++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install lcov
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: gnumake-gcc-gcov-native
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
cd .gcov/make
echo "build and run gcov/lcov/genhtml"
echo "make prepare -f make_gcov_01_generic.gmk MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
echo
make prepare -f make_gcov_01_generic.gmk MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo
echo "make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
echo
make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
echo
echo "return to wide-integer root directory"
cd ../..
- name: upload-codecov
uses: codecov/codecov-action@v4
with:
plugin: gcov
file: ${{ runner.workspace }}/wide-integer/.gcov/make/coverage.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: false
================================================
FILE: .github/workflows/wide_integer_fuzzing.yml
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2024 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
name: wide_integer_fuzzing
on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '0 2 * * *' # run at 2:00 AM UTC
jobs:
clang-fuzzing:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
compiler: [ clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install llvm lld
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: clang-fuzzing
run: |
grep BOOST_VERSION ../boost-root/boost/version.hpp
${{ matrix.compiler }} -v
echo "run fuzzing test"
./run_fuzzing.sh
clang-fuzzing-versus-cppalliance-int128:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
compiler: [ clang++ ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt install llvm lld
- name: clone-cppalliance-int128
working-directory: ${{runner.workspace}}
run: |
git clone -b master --depth 1 https://github.com/cppalliance/int128.git ${{runner.workspace}}/cppalliance-int128
- name: clang-fuzzing-versus-cppalliance-int128
run: |
${{ matrix.compiler }} -v
echo 'compiling test/fuzzing/test_fuzzing_div_versus_cppalliance_int128.cpp'
${{ matrix.compiler }} -std=c++20 -g -O2 -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=fuzzer -I. -I${{runner.workspace}}/cppalliance-int128/include test/fuzzing/test_fuzzing_div_versus_cppalliance_int128.cpp -o test_fuzzing_div_versus_cppalliance_int128
echo "run test_fuzzing_div_versus_cppalliance_int128"
rnd_seed=-seed=$(($(date +%s%N) % 4294967295))
echo
echo seed is $rnd_seed
echo
./test_fuzzing_div_versus_cppalliance_int128 -max_total_time=900 -max_len=32 -verbosity=0 -close_fd_mask=3 $rnd_seed
================================================
FILE: .github/workflows/wide_integer_sonar.yml
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
name: wide_integer_sonar
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonar-gcc-native:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/config
git submodule update --init libs/multiprecision
./bootstrap.sh
./b2 headers
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6.0.0
- name: Run Build Wrapper
run: |
build-wrapper-linux-x86-64 --out-dir ${{ runner.workspace }}/build_wrapper_output_directory g++ -finline-functions -m64 -O3 -Werror -Wall -Wextra -Wconversion -Wsign-conversion -std=c++14 -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 -DWIDE_INTEGER_HAS_MUL_8_BY_8_UNROLL -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_uintwide_t_boost_backend.cpp test/test_uintwide_t_edge_cases.cpp test/test_uintwide_t_examples.cpp test/test_uintwide_t_float_convert.cpp test/test_uintwide_t_int_convert.cpp test/test_uintwide_t_n_base.cpp test/test_uintwide_t_n_binary_ops_base.cpp test/test_uintwide_t_spot_values.cpp examples/example000_numeric_limits.cpp examples/example000a_builtin_convert.cpp examples/example001_mul_div.cpp examples/example001a_div_mod.cpp examples/example002_shl_shr.cpp examples/example003_sqrt.cpp examples/example003a_cbrt.cpp examples/example004_rootk_pow.cpp examples/example005_powm.cpp examples/example005a_pow_factors_of_p99.cpp examples/example006_gcd.cpp examples/example007_random_generator.cpp examples/example008_miller_rabin_prime.cpp examples/example008a_miller_rabin_prime.cpp examples/example008b_solovay_strassen_prime.cpp examples/example009_timed_mul.cpp examples/example009a_timed_mul_4_by_4.cpp examples/example009b_timed_mul_8_by_8.cpp examples/example010_uint48_t.cpp examples/example011_uint24_t.cpp examples/example012_rsa_crypto.cpp examples/example013_ecdsa_sign_verify.cpp examples/example014_pi_spigot_wide.cpp -o wide_integer.exe
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
--define sonar.cfamily.compile-commands=${{ runner.workspace }}/build_wrapper_output_directory/compile_commands.json
-Dsonar.organization=ckormanyos
-Dsonar.projectName=wide-integer
-Dsonar.projectKey=ckormanyos_wide-integer
================================================
FILE: .gitignore
================================================
.vs/
wide_integer.vcxproj.user
x64/
wide_integer_vs2022.vcxproj.user
================================================
FILE: .props/Directory.Build.props
================================================
true
================================================
FILE: .tidy/make/make_tidy_01_generic.gmk
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
PATH_MAKE = $(CURDIR)
PATH_PRJ = $(PATH_MAKE)/../..
PATH_SRC = $(PATH_PRJ)
PATH_TMP = $(PATH_MAKE)/tmp
PATH_ERR = $(PATH_MAKE)/err
CAT = cat
GNUECHO = echo
LS = ls
MKDIR = mkdir
TIDY = clang-tidy
RM = rm
SED = sed
include make_tidy_02_files.gmk
include make_tidy_03_flags.gmk
FILES_ALL = $(FILES_PRJ)
FILES_TIDY_TXT = $(addprefix $(PATH_TMP)/, $(notdir $(addsuffix .tidy_txt, $(FILES_ALL))))
# ------------------------------------------------------------------------------
# VPATH definition: VPATH is required for make to find the source files.
# ------------------------------------------------------------------------------
VPATH := $(sort $(dir $(FILES_ALL)))
# ------------------------------------------------------------------------------
# Main dependency: Run clang-tidy on all files and tidy tidy results.
# ------------------------------------------------------------------------------
.PHONY: tidy
tidy: $(FILES_TIDY_TXT)
# Summarize tidy results
@$(GNUECHO) +++ summarize clang-tidy results
@$(GNUECHO) +++ concatenate $(PATH_TMP)/*.tidy_txt to $(PATH_TMP)/all.tidy_txt
@$(CAT) $(PATH_TMP)/*.tidy_txt > $(PATH_TMP)/all.tidy_txt
@$(GNUECHO)
@$(GNUECHO) +++ verify existence of $(PATH_TMP)/all.tidy_txt
@$(LS) -la $(PATH_TMP)/all.tidy_txt
@$(GNUECHO)
@$(GNUECHO) +++ print summary of tidy from $(PATH_TMP)/all.tidy_txt:
@-$(SED) -n l $(PATH_TMP)/all.tidy_txt
@$(GNUECHO)
# ------------------------------------------------------------------------------
# Clean temporary files.
# ------------------------------------------------------------------------------
.PHONY: prepare
prepare:
# creating output directories
@$(GNUECHO) +++ creating output directories
@-$(MKDIR) -p $(PATH_ERR)
@-$(MKDIR) -p $(PATH_TMP)
@$(GNUECHO)
@$(GNUECHO) +++ cleaning output directories
@-$(RM) -rf $(PATH_ERR)/*.tidy_err
@-$(RM) -rf $(PATH_TMP)/*.tidy_txt
@$(GNUECHO)
@$(GNUECHO) +++ print clang-tidy version
@$(TIDY) --version
@$(GNUECHO)
@$(GNUECHO) +++ print include paths
@$(GNUECHO) $(C_INCLUDES)
@$(GNUECHO)
# ------------------------------------------------------------------------------
# pattern rule for clang-tidy analysis of cpp-files
# ------------------------------------------------------------------------------
$(PATH_TMP)/%.tidy_txt : %.cpp
@-$(GNUECHO) +++ tidying: $<
@-$(TIDY) $(TIDY_FLAGS) $< -- $(CXX_FLAGS) $(C_INCLUDES) $(C_DEFINES) > $(PATH_TMP)/$(basename $(@F)).tidy_txt 2> $(PATH_ERR)/$(basename $(@F)).tidy_err
@-$(GNUECHO)
@-$(GNUECHO) +++ print $(PATH_ERR)/$(basename $(@F)).tidy_err
@-$(SED) -n l $(PATH_ERR)/$(basename $(@F)).tidy_err
@-$(GNUECHO)
================================================
FILE: .tidy/make/make_tidy_02_files.gmk
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
FILES_PRJ = $(PATH_SRC)/test/test_uintwide_t_edge_cases \
$(PATH_SRC)/test/test_uintwide_t_examples \
$(PATH_SRC)/test/test_uintwide_t_float_convert \
$(PATH_SRC)/test/test_uintwide_t_int_convert \
$(PATH_SRC)/test/test_uintwide_t_n_base \
$(PATH_SRC)/test/test_uintwide_t_n_binary_ops_base \
$(PATH_SRC)/test/test_uintwide_t_spot_values \
$(PATH_SRC)/examples/example000a_builtin_convert \
$(PATH_SRC)/examples/example000_numeric_limits \
$(PATH_SRC)/examples/example001_mul_div \
$(PATH_SRC)/examples/example001a_div_mod \
$(PATH_SRC)/examples/example002_shl_shr \
$(PATH_SRC)/examples/example003_sqrt \
$(PATH_SRC)/examples/example003a_cbrt \
$(PATH_SRC)/examples/example004_rootk_pow \
$(PATH_SRC)/examples/example005_powm \
$(PATH_SRC)/examples/example005a_pow_factors_of_p99 \
$(PATH_SRC)/examples/example006_gcd \
$(PATH_SRC)/examples/example007_random_generator \
$(PATH_SRC)/examples/example008_miller_rabin_prime \
$(PATH_SRC)/examples/example008a_miller_rabin_prime \
$(PATH_SRC)/examples/example008b_solovay_strassen_prime \
$(PATH_SRC)/examples/example009_timed_mul \
$(PATH_SRC)/examples/example009a_timed_mul_4_by_4 \
$(PATH_SRC)/examples/example009b_timed_mul_8_by_8 \
$(PATH_SRC)/examples/example010_uint48_t \
$(PATH_SRC)/examples/example011_uint24_t \
$(PATH_SRC)/examples/example012_rsa_crypto \
$(PATH_SRC)/examples/example013_ecdsa_sign_verify \
$(PATH_SRC)/examples/example014_pi_spigot_wide
================================================
FILE: .tidy/make/make_tidy_03_flags.gmk
================================================
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2025.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
BOOST_ROOT_FOR_TIDY = /mnt/c/boost/boost_1_78_0
CC = clang++
STD = c++14
ifneq ($(MY_BOOST_ROOT),)
BOOST_ROOT_FOR_TIDY := $(MY_BOOST_ROOT)
endif
ifneq ($(MY_CC),)
CC := $(MY_CC)
endif
ifneq ($(MY_STD),)
STD := $(MY_STD)
endif
CXX_FLAGS = $(CC) \
-march=native \
-mtune=native \
-O3 \
-Wall \
-Wextra \
-Wconversion \
-Wsign-conversion \
-std=$(STD)
C_DEFINES = WIDE_INTEGER_HAS_MUL_8_BY_8_UNROLL
C_INCLUDES = $(PATH_SRC) \
$(BOOST_ROOT_FOR_TIDY)
C_DEFINES :=$(addprefix -D,$(C_DEFINES))
C_INCLUDES :=$(addprefix -I,$(C_INCLUDES))
TIDY_CHECKS = "*, \
-cert-dcl58-cpp, \
-cppcoreguidelines-rvalue-reference-param-not-moved, \
-cppcoreguidelines-avoid-do-while, \
-modernize-type-traits, \
-modernize-use-constraints, \
-misc-header-include-cycle, \
-misc-include-cleaner, \
-misc-const-correctness, \
-performance-avoid-endl, \
-readability-identifier-length, \
-readability-redundant-casting, \
-altera-struct-pack-align, \
-altera-unroll-loops, \
-fuchsia-*, \
-llvmlibc-*"
TIDY_FLAGS = --extra-arg-before=--driver-mode=g++ \
--header-filter=uintwide_t \
-warnings-as-errors=* \
-checks=$(TIDY_CHECKS)
================================================
FILE: CMakeLists.txt
================================================
project(wide-integer)
cmake_minimum_required(VERSION 3.16.3)
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set(WIDE_INTEGER_MASTER_PROJECT ON)
else()
set(WIDE_INTEGER_MASTER_PROJECT OFF)
endif()
option(WIDE_INTEGER_ENABLE_TESTS "Enable/disable tests" ${WIDE_INTEGER_MASTER_PROJECT})
if (WIDE_INTEGER_ENABLE_TESTS)
find_package(Boost)
if (Boost_FOUND)
include(CTest)
add_subdirectory("examples")
add_subdirectory("test")
endif()
endif()
add_library(WideInteger INTERFACE)
target_compile_features(WideInteger INTERFACE cxx_std_14)
target_include_directories(
WideInteger SYSTEM INTERFACE
$
$)
add_library(WideInteger::WideInteger ALIAS WideInteger)
install(TARGETS WideInteger EXPORT WideIntegerTargets)
install(
FILES math/wide_integer/uintwide_t.h
DESTINATION include/math/wide_integer/)
install(EXPORT WideIntegerTargets
FILE WideIntegerConfig.cmake
NAMESPACE WideInteger::
DESTINATION lib/cmake/wide-integer)
================================================
FILE: LICENSE_1_0.txt
================================================
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
================================================
FILE: Makefile
================================================
###############################################################################
# Copyright Christopher Kormanyos 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# My local machine
# cd /mnt/c/Users/ckorm/Documents/Ks/PC_Software/NumericalPrograms/ExtendedNumberTypes/wide_integer
# make MY_CC=g++ MY_BOOST_ROOT=/mnt/c/boost/boost_1_90_0 all
# MacOS with brew llvm
# make MY_CC=/opt/homebrew/opt/llvm/bin/clang++ MY_BOOST_ROOT=../boost-root MY_STD=c++23 MY_BREW=brew all
all : compile_and_link
BOOST_ROOT := ../boost-root
CC := clang++
STD := c++20
ifneq ($(MY_BOOST_ROOT),)
BOOST_ROOT := $(MY_BOOST_ROOT)
endif
ifneq ($(MY_CC),)
CC := $(MY_CC)
endif
ifneq ($(MY_STD),)
STD := $(MY_STD)
endif
ECHO := echo
FILES_SRC := test/test.cpp \
test/test_uintwide_t_boost_backend.cpp \
test/test_uintwide_t_edge_cases.cpp \
test/test_uintwide_t_examples.cpp \
test/test_uintwide_t_float_convert.cpp \
test/test_uintwide_t_int_convert.cpp \
test/test_uintwide_t_n_base.cpp \
test/test_uintwide_t_n_binary_ops_base.cpp \
test/test_uintwide_t_spot_values.cpp \
examples/example000a_builtin_convert.cpp \
examples/example000_numeric_limits.cpp \
examples/example001_mul_div.cpp \
examples/example001a_div_mod.cpp \
examples/example002_shl_shr.cpp \
examples/example003_sqrt.cpp \
examples/example003a_cbrt.cpp \
examples/example004_rootk_pow.cpp \
examples/example005_powm.cpp \
examples/example005a_pow_factors_of_p99.cpp \
examples/example006_gcd.cpp \
examples/example007_random_generator.cpp \
examples/example008_miller_rabin_prime.cpp \
examples/example008a_miller_rabin_prime.cpp \
examples/example008b_solovay_strassen_prime.cpp \
examples/example009_timed_mul.cpp \
examples/example009a_timed_mul_4_by_4.cpp \
examples/example009b_timed_mul_8_by_8.cpp \
examples/example010_uint48_t.cpp \
examples/example011_uint24_t.cpp \
examples/example012_rsa_crypto.cpp \
examples/example013_ecdsa_sign_verify.cpp \
examples/example014_pi_spigot_wide.cpp
CPPFLAGS := -std=$(STD) \
-finline-functions \
-march=native \
-mtune=native \
-O3 \
-Werror \
-Wall \
-Wextra \
-Wpedantic \
-Wconversion \
-Wsign-conversion \
-Wshadow \
-Wundef \
-Wunused-parameter \
-Wuninitialized \
-Wunreachable-code \
-Winit-self \
-Wzero-as-null-pointer-constant
C_DEFINES := -DWIDE_INTEGER_HAS_LIMB_TYPE_UINT64 \
-DWIDE_INTEGER_HAS_MUL_8_BY_8_UNROLL \
-DWIDE_INTEGER_NAMESPACE=ckormanyos
C_INCLUDES := -I. \
-I$(BOOST_ROOT)
ifeq ($(MY_BREW),brew)
C_INCLUDES += -isystem /opt/homebrew/opt/llvm/include
C_INCLUDES += -isystem $$(xcrun --show-sdk-path)
endif
LDFLAGS := -pthread \
-lpthread
ifeq ($(MY_BREW),brew)
LDFLAGS += -L/opt/homebrew/opt/llvm/lib
endif
clean :
@-$(ECHO)
@-$(ECHO) +++ cleaning
@-rm -f ./wide_integer || true
compile_and_link : clean
@-$(ECHO)
@-$(ECHO) +++ print compiler version
@-$(CC) --version
@-$(ECHO)
@-$(ECHO) +++ compiling and linking to wide_integer
@-$(ECHO)
-$(CC) $(CPPFLAGS) $(C_DEFINES) $(C_INCLUDES) $(LDFLAGS) $(FILES_SRC) -o wide_integer
@-$(ECHO)
@-$(ECHO) +++ check for executable wide_integer
-ls -la ./wide_integer
@-$(ECHO)
================================================
FILE: README.md
================================================
Wide-integer
==================
Wide-integer implements a generic C++ template for extended width
unsigned and signed integral types.
This C++ template header-only library implements drop-in big integer types
such as `uint128_t`, `uint256_t`, `uint384_t`, `uint512_t`, `uint1024_t`, `uint1536_t`, etc.
These can be used essentially like regular built-in integers.
Corresponding _signed_ integer types such as `int128_t`, `int256_t`, and the like
can also be used.
The big integer class is called `math::wide_integer::uintwide_t`
(i.e., `uintwide_t` residing in the `namespace` `math::wide_integer`),
as shown in greater detail below.
Wide-integer supports both unsigned as well as
signed integral types having width of
$1 {\ldots} 63 {\times} 2^N$
while being $16$, $24$, $32$ or larger.
In addition, small integer types such as software-synthesized versions of
`uint24_t`, `uint48_t`, `uint64_t`, `uint96_t`, `uint128_t`, etc.
(or signed counterparts of these) can also be created with wide-integer.
We also emphasize here that less-common types (i.e., those less common than, say,
`uint128_t`, `uint256_t`, `uint512_t`, etc.) can also be synthesized.
Types such as `uint80_t` made from five 16-bit limbs,
or `uint96_t` composed of three 32-bit limbs, or
other similar types can be readily synthesized with wide-integer.
Wide-integer also features basic realizations of several
elementary and number theoretical functions such as root finding,
random distribution, Miller-Rabin primality testing,
greatest common denominator (GCD), least common multiplier (LCM),
integer division (i.e., `divmod()`) and more.
Inclusion of a single C++14 header file
is all that is needed for using wide-integer,
as shown in the [examples](./examples).
## Implementation goals
- Signed and unsigned versions of `uintwide_t` should behave as closely as possible to the behaviors of signed and unsigned versions of built-in `int`.
- Relatively wide precision range from $24$, $32$, $64$ bits up to tens of thousands of bits.
- Moderately good efficiency over the entire wide precision range.
- Clean header-only C++14 design.
- Seamless portability to any modern C++14, 17, 20, 23 compiler and beyond.
- Scalability with small memory footprint and efficiency suitable for both PC/workstation systems as well as _bare-metal_ embedded systems.
- C++14, 17, 20, 23 and beyond `constexpr`-ness.
## Quick start
When working in your own project with wide-integer,
using the [uintwide_t.h header](./math/wide_integer/uintwide_t.h)
is straightforward. Identify the header within
its directory. Include this header path to the compiler's set
of include paths or in your project.
Then simply `#include ` in the normal C++ way.
Easy application follows via traditional C-style typedef or alias
such as `uint512_t`. An instance of the defined type can be used very much
like a built-in integral type.
In the following code, for example,
the static `uint512_t` variable `x` is initialized with unsigned, integral value `3U`.
The `main` subroutine subsequently computes $3^{301}$ with the specialized
wide-integer, namespace-specific function `pow`, which is found via ADL.
The approximate result is
$$3^{301}~{\approx}~4.10674{\times}~10^{143}\text{.}$$
See also the following informative links to Wolfram Alpha(R).
- Query the approximate value of $3^{301}$ with [`N[3^301]`](https://www.wolframalpha.com/input?i=N%5B3%5E301%5D)
- Verify the exact value of $3^{301}$ with [`3^301`](https://www.wolframalpha.com/input?i=3%5E301)
This example, compiled with successful output result,
is shown in its entirety in the following
[short link](https://godbolt.org/z/bjxxrK1xP) to [godbolt](https://godbolt.org).
In particular,
```cpp
#include