Browse Source

fix: reverse testing order for operator & and |

Sam Jaffe 3 months ago
parent
commit
25facc3675
1 changed files with 6 additions and 6 deletions
  1. 6 6
      include/jvalidate/detail/tribool.h

+ 6 - 6
include/jvalidate/detail/tribool.h

@@ -25,22 +25,22 @@
     }                                                                                              \
                                                                                                    \
     friend TypeName operator|(TypeName lhs, TypeName rhs) {                                        \
-      if (lhs.state_ == Maybe && rhs.state_ == Maybe) {                                            \
-        return Maybe;                                                                              \
-      }                                                                                            \
       if (lhs.state_ == True || rhs.state_ == True) {                                              \
         return True;                                                                               \
       }                                                                                            \
+      if (lhs.state_ == Maybe || rhs.state_ == Maybe) {                                            \
+        return Maybe;                                                                              \
+      }                                                                                            \
       return False;                                                                                \
     }                                                                                              \
                                                                                                    \
     friend TypeName operator&(TypeName lhs, TypeName rhs) {                                        \
-      if (lhs.state_ == Maybe && rhs.state_ == Maybe) {                                            \
-        return Maybe;                                                                              \
-      }                                                                                            \
       if (lhs.state_ == False || rhs.state_ == False) {                                            \
         return False;                                                                              \
       }                                                                                            \
+      if (lhs.state_ == Maybe && rhs.state_ == Maybe) {                                            \
+        return Maybe;                                                                              \
+      }                                                                                            \
       return True;                                                                                 \
     }                                                                                              \
                                                                                                    \