From 7fd010710c0a34ff103bec3fb271f0c207bfcc53 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 Aug 2016 13:40:19 -0700 Subject: 3259 Prefer preincrement operators wherever possible. Old versions of compilers used to be better at optimizing them. Even if we don't care about performance it's useful to make unary operators look like unary operators wherever possible, and to distinguish the 'statement form' which doesn't care about the value of the expression from the postincrement which usually increments as a side-effect in some larger computation (and so is worth avoiding except for some common idioms, or perhaps even there). --- 080display.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '080display.cc') diff --git a/080display.cc b/080display.cc index 9619e5ab..f40b40c8 100644 --- a/080display.cc +++ b/080display.cc @@ -223,7 +223,7 @@ case MOVE_CURSOR_DOWN_ON_DISPLAY: { int h=tb_height(); int height = (h >= 0) ? h : 0; if (Display_row < height-1) { - Display_row++; + ++Display_row; tb_set_cursor(Display_column, Display_row); if (Autodisplay) tb_present(); } @@ -241,7 +241,7 @@ case MOVE_CURSOR_UP_ON_DISPLAY: { :(before "End Primitive Recipe Implementations") case MOVE_CURSOR_UP_ON_DISPLAY: { if (Display_row > 0) { - Display_row--; + --Display_row; tb_set_cursor(Display_column, Display_row); if (Autodisplay) tb_present(); } @@ -261,7 +261,7 @@ case MOVE_CURSOR_RIGHT_ON_DISPLAY: { int w=tb_width(); int width = (w >= 0) ? w : 0; if (Display_column < width-1) { - Display_column++; + ++Display_column; tb_set_cursor(Display_column, Display_row); if (Autodisplay) tb_present(); } @@ -279,7 +279,7 @@ case MOVE_CURSOR_LEFT_ON_DISPLAY: { :(before "End Primitive Recipe Implementations") case MOVE_CURSOR_LEFT_ON_DISPLAY: { if (Display_column > 0) { - Display_column--; + --Display_column; tb_set_cursor(Display_column, Display_row); if (Autodisplay) tb_present(); } @@ -293,7 +293,7 @@ else if (tb_is_active()) { } :(code) void move_cursor_to_start_of_next_line_on_display() { - if (Display_row < tb_height()-1) Display_row++; + if (Display_row < tb_height()-1) ++Display_row; else Display_row = 0; Display_column = 0; tb_set_cursor(Display_column, Display_row); -- cgit 1.4.1-2-gfad0