Introduction
Introduction Statistics Contact Development Disclaimer Help
tClarify some or exclusive expressions - st - [fork] customized build of st, th…
git clone git://src.adamsgaard.dk/st
Log
Files
Refs
README
LICENSE
---
commit ba9d0365ac7e138b643d7179457f8465a1dc1191
parent 950ff21e17af487b205ea0b666be015790114fa7
Author: Roberto E. Vargas Caballero <[email protected]>
Date: Thu, 8 Nov 2012 17:17:26 +0100
Clarify some or exclusive expressions
Since relational expresions are always evaluated to 0 or 1, we can use
bitwise xor operator instead of using more complex boolean expressions.
---
st.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Diffstat:
M st.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/st.c b/st.c
t@@ -1475,15 +1475,15 @@ tsetmode(bool priv, bool set, int *args, int narg) {
break;
case 1049: /* = 1047 and 1048 */
case 47:
- case 1047:
- if(IS_SET(MODE_ALTSCREEN))
+ case 1047: {
+ bool alt = IS_SET(MODE_ALTSCREEN) != 0;
+ if(alt)
tclearregion(0, 0, term.col-1, term.ro…
- if((set && !IS_SET(MODE_ALTSCREEN)) ||
- (!set && IS_SET(MODE_ALTSCREEN…
+ if(set ^ alt) /* set is always …
tswapscreen();
- }
if(*args != 1049)
break;
+ }
/* pass through */
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
t@@ -2546,9 +2546,9 @@ drawregion(int x1, int y1, int x2, int y2) {
int ic, ib, x, y, ox, sl;
Glyph base, new;
char buf[DRAW_BUF_SIZ];
- bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN);
+ bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN) != 0;
- if((sel.alt && !alt) || (!sel.alt && alt))
+ if((sel.alt != 0) ^ alt)
ena_sel = 0;
if(!(xw.state & WIN_VISIBLE))
return;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.