Patchwork [3/6] tcg: Add tcg_invert_cond.

login
register
mail settings
Submitter Richard Henderson
Date Jan. 7, 2010, 6:46 p.m.
Message ID <0e3618853fce06b351f16061c366d0e19f381f9d.1262890015.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/42459/
State New
Headers show

Comments

Richard Henderson - Jan. 7, 2010, 6:46 p.m.
It is very handy to have a reliable mapping of a condition to its inverse.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/tcg/tcg.h b/tcg/tcg.h
index 121b17c..b218abe 100644
--- 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);