tcg: add tcg_invert_cond
authorRichard Henderson <rth@twiddle.net>
Thu, 7 Jan 2010 18:15:20 +0000 (10:15 -0800)
committerAurelien Jarno <aurelien@aurel32.net>
Sat, 6 Feb 2010 16:14:24 +0000 (17:14 +0100)
It is very handy to have a reliable mapping of a condition to its inverse.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/tcg.h

index 121b17c..b218abe 100644 (file)
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -205,6 +205,11 @@ typedef enum {
     TCG_COND_GTU,
 } TCGCond;
 
+static inline TCGCond tcg_invert_cond(TCGCond c)
+{
+    return (TCGCond)(c ^ 1);
+}
+
 static inline TCGCond tcg_unsigned_cond(TCGCond c)
 {
     return (c >= TCG_COND_LT && c <= TCG_COND_GT ? c + 4 : c);