Skip to content

Commit

Permalink
SFINAE specialization for lns regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravenwater committed Nov 14, 2024
1 parent 8024e39 commit 14deebf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 17 deletions.
5 changes: 1 addition & 4 deletions static/lns/arithmetic/addition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

namespace sw { namespace universal {

//template<typename LnsType,
// std::enable_if_t<is_lns<LnsType>, LnsType> = 0
//>
template<typename LnsType>
template<typename LnsType, std::enable_if_t<is_lns<LnsType>, bool> = true>
int VerifyAddition(bool reportTestCases) {
constexpr size_t nbits = LnsType::nbits;
//constexpr size_t rbits = LnsType::rbits;
Expand Down
5 changes: 1 addition & 4 deletions static/lns/arithmetic/division.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ namespace sw {
namespace universal {
namespace local {

//template<typename LnsType,
// std::enable_if_t<is_lns<LnsType>, LnsType> = 0
//>
template<typename LnsType>
template<typename LnsType, std::enable_if_t<is_lns<LnsType>, bool> = true>
int VerifyDivision(bool reportTestCases) {
constexpr size_t nbits = LnsType::nbits;
//constexpr size_t rbits = LnsType::rbits;
Expand Down
5 changes: 1 addition & 4 deletions static/lns/arithmetic/multiplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ namespace sw {
namespace universal {
namespace local {

//template<typename LnsType,
// std::enable_if_t<is_lns<LnsType>, LnsType> = 0
//>
template<typename LnsType>
template<typename LnsType, std::enable_if_t<is_lns<LnsType>, bool> = true>
int VerifyMultiplication(bool reportTestCases) {
constexpr size_t nbits = LnsType::nbits;
//constexpr size_t rbits = LnsType::rbits;
Expand Down
5 changes: 1 addition & 4 deletions static/lns/arithmetic/subtraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

namespace sw { namespace universal {

//template<typename LnsType,
// std::enable_if_t<is_lns<LnsType>, LnsType> = 0
//>
template<typename LnsType>
template<typename LnsType, std::enable_if_t<is_lns<LnsType>, bool> = true>
int VerifySubtraction(bool reportTestCases) {
constexpr size_t nbits = LnsType::nbits;
//constexpr size_t rbits = LnsType::rbits;
Expand Down
2 changes: 1 addition & 1 deletion static/lns/conversion/assignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace sw { namespace universal {

// TODO: needs a type trait to only match on lns<> type
template<typename LnsType>
template<typename LnsType, std::enable_if_t<is_lns<LnsType>, bool> = true>
int ValidateAssignment(bool reportTestCases) {
constexpr size_t nbits = LnsType::nbits;
constexpr size_t NR_ENCODINGS = (1ull << nbits);
Expand Down

0 comments on commit 14deebf

Please sign in to comment.