diff options
author | Jesse Luehrs <doy@tozt.net> | 2017-02-11 07:38:26 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2017-02-11 08:51:09 -0500 |
commit | 981d3ec01c7774609193ec2e3106b7856f7f7933 (patch) | |
tree | 683ef66437b31358435342d4ddb1c37829832f00 /src | |
parent | 0666301e5286dbbde56503cd0a42c06bf60dd648 (diff) | |
download | runes-981d3ec01c7774609193ec2e3106b7856f7f7933.tar.gz runes-981d3ec01c7774609193ec2e3106b7856f7f7933.zip |
optimize runes_display_continue_string a bit
continuing is the common case, so this trades two compare+branches for
two ORs and a NOT
Diffstat (limited to 'src')
-rw-r--r-- | src/display.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/display.c b/src/display.c index 28b63e7..7cee2a9 100644 --- a/src/display.c +++ b/src/display.c @@ -253,16 +253,11 @@ static int runes_display_continue_string( if (!old->len || !new->len) { return 0; } - if (old->attrs.fgcolor.id != new->attrs.fgcolor.id) { - return 0; - } - if (old->attrs.bgcolor.id != new->attrs.bgcolor.id) { - return 0; - } - if (old->attrs.attrs != new->attrs.attrs) { - return 0; - } - return 1; + return !( + (old->attrs.fgcolor.id - new->attrs.fgcolor.id) | + (old->attrs.bgcolor.id - new->attrs.bgcolor.id) | + (old->attrs.attrs - new->attrs.attrs) + ); } static void runes_display_draw_string( |