#ifndef LLVM_LIBC_SRC___SUPPORT_SIGN_H
#define LLVM_LIBC_SRC___SUPPORT_SIGN_H
#include "src/__support/macros/attributes.h"
struct Sign {
LIBC_INLINE constexpr bool is_pos() const { return !is_negative; }
LIBC_INLINE constexpr bool is_neg() const { return is_negative; }
LIBC_INLINE friend constexpr bool operator==(Sign a, Sign b) {
return a.is_negative == b.is_negative;
}
LIBC_INLINE friend constexpr bool operator!=(Sign a, Sign b) {
return !(a == b);
}
static const Sign POS;
static const Sign NEG;
private:
LIBC_INLINE constexpr explicit Sign(bool is_negative)
: is_negative(is_negative) {}
bool is_negative;
};
LIBC_INLINE_VAR constexpr Sign Sign::NEG = Sign(true);
LIBC_INLINE_VAR constexpr Sign Sign::POS = Sign(false);
#endif