Lines Matching full:boolean

1 //===--- Boolean.h - Wrapper for boolean types for the VM -------*- C++ -*-===//
24 /// Wrapper around boolean types.
25 class Boolean final {
27 /// Underlying boolean.
31 /// Zero-initializes a boolean.
32 Boolean() : V(false) {}
33 explicit Boolean(bool V) : V(V) {}
35 bool operator<(Boolean RHS) const { return V < RHS.V; }
36 bool operator>(Boolean RHS) const { return V > RHS.V; }
37 bool operator<=(Boolean RHS) const { return V <= RHS.V; }
38 bool operator>=(Boolean RHS) const { return V >= RHS.V; }
39 bool operator==(Boolean RHS) const { return V == RHS.V; }
40 bool operator!=(Boolean RHS) const { return V != RHS.V; }
44 Boolean operator-() const { return Boolean(V); }
45 Boolean operator-(const Boolean &Other) const { return Boolean(V - Other.V); }
46 Boolean operator~() const { return Boolean(true); }
61 Boolean toUnsigned() const { return *this; }
74 ComparisonCategoryResult compare(const Boolean &RHS) const {
80 Boolean truncate(unsigned TruncBits) const { return *this; }
90 static Boolean min(unsigned NumBits) { return Boolean(false); }
91 static Boolean max(unsigned NumBits) { return Boolean(true); }
93 template <typename T> static Boolean from(T Value) {
95 return Boolean(Value != 0);
96 return Boolean(static_cast<decltype(Boolean::V)>(Value) != 0);
100 static std::enable_if_t<SrcBits != 0, Boolean>
102 return Boolean(!Value.isZero());
105 static Boolean zero() { return from(false); }
108 static Boolean from(T Value, unsigned NumBits) {
109 return Boolean(Value);
116 static bool increment(Boolean A, Boolean *R) {
117 *R = Boolean(true);
121 static bool decrement(Boolean A, Boolean *R) {
125 static bool add(Boolean A, Boolean B, unsigned OpBits, Boolean *R) {
126 *R = Boolean(A.V || B.V);
130 static bool sub(Boolean A, Boolean B, unsigned OpBits, Boolean *R) {
131 *R = Boolean(A.V ^ B.V);
135 static bool mul(Boolean A, Boolean B, unsigned OpBits, Boolean *R) {
136 *R = Boolean(A.V && B.V);
140 static bool inv(Boolean A, Boolean *R) {
141 *R = Boolean(!A.V);
145 static bool neg(Boolean A, Boolean *R) {
146 *R = Boolean(A.V);
151 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Boolean &B) {