Skip to content

Commit

Permalink
Update CI msys2 and AVR
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Jan 23, 2024
1 parent 647251c commit 5066f3d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/wide_integer.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2020 - 2023.
# Copyright Christopher Kormanyos 2020 - 2024.
# 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)
Expand Down Expand Up @@ -525,17 +525,25 @@ jobs:
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
mingw-winhost-x64:
runs-on: windows-2019
msys2-winhost-x64:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
compiler: [ g++ ]
standard: [ c++14, c++2a ]
standard: [ c++14, c++20 ]
steps:
- uses: actions/checkout@v3
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
Expand All @@ -545,15 +553,14 @@ jobs:
git submodule update --init libs/multiprecision
./bootstrap.bat
./b2 headers
- name: mingw-winhost-x64
shell: cmd
- 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/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
dir %cd%\wide_integer.exe
%cd%\wide_integer.exe
ls -la ./wide_integer.exe
./wide_integer.exe
cygwin-winhost-x64:
runs-on: windows-latest
strategy:
Expand Down
23 changes: 17 additions & 6 deletions examples/example001_mul_div.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2018 - 2023. //
// Copyright Christopher Kormanyos 2018 - 2024. //
// 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) //
Expand All @@ -8,6 +8,14 @@
#include <examples/example_uintwide_t.h>
#include <math/wide_integer/uintwide_t.h>

#if (defined(__GNUC__) && defined(__AVR__) && (__GNUC__ < 10))
#define WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST const
#define WIDE_INTEGER_EXAMPLE001_CONSTEXPR_IS_COMPILE_TIME_CONSTANT 0
#else
#define WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST constexpr
#define WIDE_INTEGER_EXAMPLE001_CONSTEXPR_IS_COMPILE_TIME_CONSTANT 1
#endif

#if defined(WIDE_INTEGER_NAMESPACE)
auto WIDE_INTEGER_NAMESPACE::math::wide_integer::example001_mul_div() -> bool
#else
Expand All @@ -26,19 +34,22 @@ auto ::math::wide_integer::example001_mul_div() -> bool
&& std::numeric_limits<uint512_t>::digits == static_cast<int>(INT16_C(512))),
"Error: Incorrect digit count for this example");

constexpr uint256_t a("0xF4DF741DE58BCB2F37F18372026EF9CBCFC456CB80AF54D53BDEED78410065DE");
constexpr uint256_t b("0x166D63E0202B3D90ECCEAA046341AB504658F55B974A7FD63733ECF89DD0DF75");
WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST uint256_t a("0xF4DF741DE58BCB2F37F18372026EF9CBCFC456CB80AF54D53BDEED78410065DE");
WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST uint256_t b("0x166D63E0202B3D90ECCEAA046341AB504658F55B974A7FD63733ECF89DD0DF75");

constexpr auto c = uint512_t(a) * uint512_t(b);
constexpr auto d = (a / b);
WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST auto c = uint512_t(a) * uint512_t(b);
WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST auto d = (a / b);

constexpr auto result_is_ok =
WIDE_INTEGER_EXAMPLE001_CONSTEXPR_OR_CONST auto result_is_ok =
(
(c == "0x1573D6A7CEA734D99865C4F428184983CDB018B80E9CC44B83C773FBE11993E7E491A360C57EB4306C61F9A04F7F7D99BE3676AAD2D71C5592D5AE70F84AF076")
&& (static_cast<std::uint_fast8_t>(d) == static_cast<std::uint_fast8_t>(UINT8_C(10)))
);

#if (defined(WIDE_INTEGER_EXAMPLE001_CONSTEXPR_IS_COMPILE_TIME_CONSTANT) \
&& (WIDE_INTEGER_EXAMPLE001_CONSTEXPR_IS_COMPILE_TIME_CONSTANT == 1))
static_assert(result_is_ok, "Error: example001_mul_div not OK!");
#endif

return result_is_ok;
}
Expand Down
19 changes: 15 additions & 4 deletions examples/example003_sqrt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2018 - 2022. //
// Copyright Christopher Kormanyos 2018 - 2024. //
// 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) //
Expand All @@ -8,6 +8,14 @@
#include <examples/example_uintwide_t.h>
#include <math/wide_integer/uintwide_t.h>

#if (defined(__GNUC__) && defined(__AVR__) && (__GNUC__ < 10))
#define WIDE_INTEGER_EXAMPLE003_CONSTEXPR_OR_CONST const
#define WIDE_INTEGER_EXAMPLE003_CONSTEXPR_IS_COMPILE_TIME_CONSTANT 0
#else
#define WIDE_INTEGER_EXAMPLE003_CONSTEXPR_OR_CONST constexpr
#define WIDE_INTEGER_EXAMPLE003_CONSTEXPR_IS_COMPILE_TIME_CONSTANT 1
#endif

#if defined(WIDE_INTEGER_NAMESPACE)
auto WIDE_INTEGER_NAMESPACE::math::wide_integer::example003_sqrt() -> bool
#else
Expand All @@ -20,13 +28,16 @@ auto ::math::wide_integer::example003_sqrt() -> bool
using ::math::wide_integer::uint256_t;
#endif

constexpr uint256_t a("0xF4DF741DE58BCB2F37F18372026EF9CBCFC456CB80AF54D53BDEED78410065DE");
WIDE_INTEGER_EXAMPLE003_CONSTEXPR_OR_CONST uint256_t a("0xF4DF741DE58BCB2F37F18372026EF9CBCFC456CB80AF54D53BDEED78410065DE");

constexpr uint256_t s = sqrt(a);
WIDE_INTEGER_EXAMPLE003_CONSTEXPR_OR_CONST uint256_t s = sqrt(a);

constexpr bool result_is_ok = (s == "0xFA5FE7853F1D4AD92BDF244179CA178B");
WIDE_INTEGER_EXAMPLE003_CONSTEXPR_OR_CONST bool result_is_ok = (s == "0xFA5FE7853F1D4AD92BDF244179CA178B");

#if (defined(WIDE_INTEGER_EXAMPLE003_CONSTEXPR_IS_COMPILE_TIME_CONSTANT) \
&& (WIDE_INTEGER_EXAMPLE003_CONSTEXPR_IS_COMPILE_TIME_CONSTANT == 1))
static_assert(result_is_ok, "Error: example003_sqrt not OK!");
#endif

return result_is_ok;
}
Expand Down

0 comments on commit 5066f3d

Please sign in to comment.