Skip to content

Commit

Permalink
windows error
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishYUO committed Apr 11, 2021
1 parent b032274 commit 2c41f11
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
48 changes: 24 additions & 24 deletions ciphers/uint128_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ class uint128_t {
return *this;
}

uint128_t operator&(const uint128_t &p) {
inline uint128_t operator&(const uint128_t &p) {
return uint128_t(this->f & p.f, this->s & p.s);
}

Expand All @@ -714,11 +714,11 @@ class uint128_t {

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator|(const T p) {
inline uint128_t operator|(const T p) {
return uint128_t(p | s);
}

uint128_t operator|(const uint128_t &p) {
inline uint128_t operator|(const uint128_t &p) {
return uint128_t(this->f | p.f, this->s | p.s);
}

Expand All @@ -730,18 +730,18 @@ class uint128_t {

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t &operator|=(const T p) {
inline uint128_t &operator|=(const T p) {
s |= p.s;
return *this;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator^(const T p) {
inline uint128_t operator^(const T p) {
return uint128_t(this->f, this->s ^ p);
}

uint128_t operator^(const uint128_t &p) {
inline uint128_t operator^(const uint128_t &p) {
return uint128_t(this->f ^ p.f, this->s ^ p.s);
}

Expand All @@ -753,7 +753,7 @@ class uint128_t {

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t &operator^=(const T &p) {
inline uint128_t &operator^=(const T &p) {
s ^= p;
return *this;
}
Expand Down Expand Up @@ -787,100 +787,100 @@ class uint128_t {
// Arithmetic operators
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator+(const T &p, const uint128_t &q) {
inline uint128_t operator+(const T &p, const uint128_t &q) {
return uint128_t(p) + q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator-(const T p, const uint128_t &q) {
inline uint128_t operator-(const T p, const uint128_t &q) {
return uint128_t(p) - q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator*(const T p, const uint128_t &q) {
return q * p;
inline uint128_t operator*(const T p, const uint128_t &q) {
return uint128_t(p) * q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator/(const T p, const uint128_t &q) {
inline uint128_t operator/(const T p, const uint128_t &q) {
return uint128_t(p) / q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator%(const T p, const uint128_t &q) {
inline uint128_t operator%(const T p, const uint128_t &q) {
return uint128_t(p) % q;
}

// Bitwise operators
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator&(const T &p, const uint128_t &q) {
inline uint128_t operator&(const T &p, const uint128_t &q) {
return uint128_t(p) & q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator|(const T p, const uint128_t &q) {
inline uint128_t operator|(const T p, const uint128_t &q) {
return uint128_t(p) | q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
uint128_t operator^(const T p, const uint128_t &q) {
inline uint128_t operator^(const T p, const uint128_t &q) {
return uint128_t(p) ^ q;
}

// Boolean operators
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator&&(const T p, const uint128_t &q) {
inline bool operator&&(const T p, const uint128_t &q) {
return uint128_t(p) && q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator||(const T p, const uint128_t &q) {
inline bool operator||(const T p, const uint128_t &q) {
return uint128_t(p) || q;
}

// Comparison operators
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator==(const T p, const uint128_t &q) {
inline bool operator==(const T p, const uint128_t &q) {
return uint128_t(p) == q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator!=(const T p, const uint128_t &q) {
inline bool operator!=(const T p, const uint128_t &q) {
return uint128_t(p) != q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator<(const T p, const uint128_t &q) {
inline bool operator<(const T p, const uint128_t &q) {
return uint128_t(p) < q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator<=(const T p, const uint128_t &q) {
inline bool operator<=(const T p, const uint128_t &q) {
return uint128_t(p) <= q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator>(const T p, const uint128_t &q) {
inline bool operator>(const T p, const uint128_t &q) {
return uint128_t(p) > q;
}

template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
bool operator>=(const T p, const uint128_t &q) {
inline bool operator>=(const T p, const uint128_t &q) {
return uint128_t(p) >= q;
}

Expand Down
22 changes: 11 additions & 11 deletions ciphers/uint256_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ class uint256_t {
* @returns addition of this and p, returning uint256_t integer
*/
inline uint256_t operator+(const uint256_t &p) {
uint32_t app = (s + p.s < s);
return {f + app + p.f, p.s + s};
bool app = (s + p.s < s);
return uint256_t(f + p.f + app, p.s + s);
}

/**
Expand All @@ -210,7 +210,7 @@ class uint256_t {
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
inline uint256_t &operator+=(const T &p) {
uint32_t app = (p + s < s);
bool app = (p + s < s);
this->f += app;
this->s += p;
return *this;
Expand All @@ -222,8 +222,8 @@ class uint256_t {
* @returns addition of this and p, returning this
*/
inline uint256_t &operator+=(const uint256_t &p) {
uint32_t _app = (p.s + s < s);
f += _app + p.f;
bool app = (p.s + s < s);
f += app + p.f;
s += p.s;
return *this;
}
Expand Down Expand Up @@ -255,7 +255,7 @@ class uint256_t {
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
inline uint256_t operator-(const T &p) {
uint32_t app = (p > s);
bool app = (p > s);
return uint256_t(f - app, s - p);
}

Expand All @@ -265,8 +265,8 @@ class uint256_t {
* @returns subtraction of this and p, returning uint256_t integer
*/
inline uint256_t operator-(const uint256_t &p) {
uint32_t app = p.s > s;
return {f - p.f - app, s - p.s};
bool app = p.s > s;
return uint256_t(f - p.f - app, s - p.s);
}

/**
Expand Down Expand Up @@ -302,7 +302,7 @@ class uint256_t {
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
inline uint256_t operator-=(const T p) {
uint32_t app = (p > s);
bool app = (p > s);
f -= app;
s -= p;
return *this;
Expand All @@ -314,8 +314,8 @@ class uint256_t {
* @returns subtraction of this and p, returning this
*/
inline uint256_t &operator-=(const uint256_t &p) {
uint32_t app = p.s > s;
f = f - app - p.f;
bool app = p.s > s;
f = f - p.f - app;
s -= p.s;
return *this;
}
Expand Down

0 comments on commit 2c41f11

Please sign in to comment.