commit edb0e68a963aa75465e20b5357a20b78d5a340e8 from: Marcel Rodrigues date: Mon Jun 01 22:49:17 2015 UTC More readable division by two. commit - cf66423ff73d3b6e45329b4aba7013156344b617 commit + edb0e68a963aa75465e20b5357a20b78d5a340e8 blob - 4a5371e0b2aac205d6a1c1889d4c464bbe43d2a9 blob + 7ab5be38f634d4f9ebf62874585a5296cb5c179c --- rover.c +++ rover.c @@ -146,7 +146,7 @@ add_mark(Marks *marks, char *dirpath, char *entry) /* Append mark to directory. */ if (marks->nentries == marks->bulk) { /* Expand bulk to accomodate new entry. */ - int extra = marks->bulk >> 1; + int extra = marks->bulk / 2; marks->bulk += extra; /* bulk *= 1.5; */ marks->entries = realloc(marks->entries, marks->bulk * sizeof *marks->entries); @@ -374,13 +374,13 @@ update_view() mvwhline(rover.window, i + 1, 1, ' ', COLS - 2); if (rover.nfiles > HEIGHT) { int center, height; - center = (SCROLL + (HEIGHT >> 1)) * HEIGHT / rover.nfiles; + center = (SCROLL + (HEIGHT / 2)) * HEIGHT / rover.nfiles; height = (HEIGHT-1) * HEIGHT / rover.nfiles; if (!height) height = 1; wcolor_set(rover.window, RVC_BORDER, NULL); wborder(rover.window, 0, 0, 0, 0, 0, 0, 0, 0); wcolor_set(rover.window, RVC_SCROLLBAR, NULL); - mvwvline(rover.window, center-(height>>1)+1, COLS-1, RVS_SCROLLBAR, height); + mvwvline(rover.window, center-(height/2)+1, COLS-1, RVS_SCROLLBAR, height); wcolor_set(rover.window, DEFAULT, NULL); } STATUS[0] = FLAGS & SHOW_FILES ? 'F' : ' '; @@ -404,7 +404,7 @@ message(const char *msg, Color color) int len, pos; len = strlen(msg); - pos = (STATUSPOS - len) >> 1; + pos = (STATUSPOS - len) / 2; attr_on(A_BOLD, NULL); color_set(color, NULL); mvaddstr(LINES - 1, pos, msg); @@ -527,7 +527,7 @@ try_to_sel(const char *target) while ((ESEL+1) < rover.nfiles && strcoll(ENAME(ESEL), target) < 0) ESEL++; if (rover.nfiles > HEIGHT) { - SCROLL = ESEL - (HEIGHT >> 1); + SCROLL = ESEL - (HEIGHT / 2); SCROLL = MIN(MAX(SCROLL, 0), rover.nfiles - HEIGHT); } }