mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
windows error
This commit is contained in:
parent
b032274df1
commit
2c41f1116c
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user