From 8b3b4f852b741d64a2eec9695dfe61fe2a05c531 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 27 Dec 2012 15:26:01 -0700 Subject: [PATCH] regcomp.c: Use xor to save a test (Perhaps the C optimizer already figures this out.) --- regcomp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/regcomp.c b/regcomp.c index 9008ae7..35fd196 100644 --- a/regcomp.c +++ b/regcomp.c @@ -11459,7 +11459,11 @@ parseit: if (UCHARAT(RExC_parse) == '^') { RExC_parse++; n--; - value = value == 'p' ? 'P' : 'p'; /* toggle */ + /* toggle. (The rhs xor gets the single bit that + * differs between P and p; the other xor inverts just + * that bit) */ + value ^= 'P' ^ 'p'; + while (isSPACE(UCHARAT(RExC_parse))) { RExC_parse++; n--; -- 2.7.4