diff --git a/include/ctbignum/config.hpp b/include/ctbignum/config.hpp new file mode 100644 index 0000000..b8326df --- /dev/null +++ b/include/ctbignum/config.hpp @@ -0,0 +1,27 @@ +// +// This file is part of: +// +// CTBignum +// +// C++ Library for Compile-Time and Run-Time Multi-Precision and Modular Arithmetic +// +// Copyright 2018 Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef CT_CONFIG_HPP +#define CT_CONFIG_HPP + +#define CBN_ALWAYS_INLINE [[gnu::always_inline] + +#endif diff --git a/include/ctbignum/montgomery.hpp b/include/ctbignum/montgomery.hpp index 14ca321..0f41191 100644 --- a/include/ctbignum/montgomery.hpp +++ b/include/ctbignum/montgomery.hpp @@ -24,13 +24,15 @@ #ifndef CT_MONTGOMERY_HPP #define CT_MONTGOMERY_HPP -#include // std::size_t #include +#include #include #include #include #include #include + +#include // std::size_t #include namespace cbn { @@ -79,7 +81,7 @@ constexpr auto montgomery_reduction(big_int A, template -[[gnu::always_inline]] +CBN_ALWAYS_INLINE constexpr auto montgomery_mul(big_int x, big_int y, std::integer_sequence) { // Montgomery multiplication with compile-time modulus diff --git a/include/ctbignum/mult.hpp b/include/ctbignum/mult.hpp index 56638f5..a378d55 100644 --- a/include/ctbignum/mult.hpp +++ b/include/ctbignum/mult.hpp @@ -25,6 +25,7 @@ #define CT_MULT_HPP #include +#include #include #include @@ -50,7 +51,7 @@ constexpr auto short_mul(big_int a, T b) { } template -[[gnu::always_inline]] +CBN_ALWAYS_INLINE constexpr auto mul(big_int u, big_int v) { using TT = typename dbl_bitlen::type;