diff options
| author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2012-11-08 17:17:26 +0100 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2012-11-08 17:17:26 +0100 |
| commit | ba9d0365ac7e138b643d7179457f8465a1dc1191 (patch) | |
| tree | 33c8251c5c7ca952626004233fa1552573ed27d0 /st.c | |
| parent | Fix bug restoring cursor position (diff) | |
| download | st-ba9d0365ac7e138b643d7179457f8465a1dc1191.tar.gz st-ba9d0365ac7e138b643d7179457f8465a1dc1191.zip | |
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 (limited to '')
| -rw-r--r-- | st.c | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -1475,15 +1475,15 @@ tsetmode(bool priv, bool set, int *args, int narg) { | |||
| 1475 | break; | 1475 | break; |
| 1476 | case 1049: /* = 1047 and 1048 */ | 1476 | case 1049: /* = 1047 and 1048 */ |
| 1477 | case 47: | 1477 | case 47: |
| 1478 | case 1047: | 1478 | case 1047: { |
| 1479 | if(IS_SET(MODE_ALTSCREEN)) | 1479 | bool alt = IS_SET(MODE_ALTSCREEN) != 0; |
| 1480 | if(alt) | ||
| 1480 | tclearregion(0, 0, term.col-1, term.row-1); | 1481 | tclearregion(0, 0, term.col-1, term.row-1); |
| 1481 | if((set && !IS_SET(MODE_ALTSCREEN)) || | 1482 | if(set ^ alt) /* set is always 1 or 0 */ |
| 1482 | (!set && IS_SET(MODE_ALTSCREEN))) { | ||
| 1483 | tswapscreen(); | 1483 | tswapscreen(); |
| 1484 | } | ||
| 1485 | if(*args != 1049) | 1484 | if(*args != 1049) |
| 1486 | break; | 1485 | break; |
| 1486 | } | ||
| 1487 | /* pass through */ | 1487 | /* pass through */ |
| 1488 | case 1048: | 1488 | case 1048: |
| 1489 | tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); | 1489 | tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); |
| @@ -2546,9 +2546,9 @@ drawregion(int x1, int y1, int x2, int y2) { | |||
| 2546 | int ic, ib, x, y, ox, sl; | 2546 | int ic, ib, x, y, ox, sl; |
| 2547 | Glyph base, new; | 2547 | Glyph base, new; |
| 2548 | char buf[DRAW_BUF_SIZ]; | 2548 | char buf[DRAW_BUF_SIZ]; |
| 2549 | bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN); | 2549 | bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN) != 0; |
| 2550 | 2550 | ||
| 2551 | if((sel.alt && !alt) || (!sel.alt && alt)) | 2551 | if((sel.alt != 0) ^ alt) |
| 2552 | ena_sel = 0; | 2552 | ena_sel = 0; |
| 2553 | if(!(xw.state & WIN_VISIBLE)) | 2553 | if(!(xw.state & WIN_VISIBLE)) |
| 2554 | return; | 2554 | return; |
