Calculate word size inline

This commit is contained in:
Arun Prakash Jana 2017-07-03 00:55:47 +05:30
parent b6b164572e
commit 093caecd82
No known key found for this signature in database
GPG key ID: A75979F35C080412

14
nnn.c
View file

@ -161,11 +161,11 @@ extern int wget_wch(WINDOW *win, wint_t *wch);
static settings cfg = {0, 0, 0, 0, 0, 1, 1, 0}; static settings cfg = {0, 0, 0, 0, 0, 1, 1, 0};
/* Idle timeout in seconds, 0 to disable */ /* Idle timeout in seconds, 0 to disable */
static int idletimeout; static uint idletimeout;
static struct entry *dents; static struct entry *dents;
static int ndents, cur, total_dents; static int ndents, cur, total_dents;
static int idle; static uint idle;
static char *player; static char *player;
static char *copier; static char *copier;
static char *editor; static char *editor;
@ -177,7 +177,7 @@ static size_t fs_free;
static uint open_max; static uint open_max;
static bm bookmark[MAX_BM]; static bm bookmark[MAX_BM];
static const double div_2_pow_10 = 1.0 / 1024.0; static const double div_2_pow_10 = 1.0 / 1024.0;
static uint _WSHIFT; static uint _WSHIFT = (sizeof(ulong) == 8) ? 3 : 2;
/* Utilities to open files, run actions */ /* Utilities to open files, run actions */
static char * const utils[] = { static char * const utils[] = {
@ -2465,7 +2465,6 @@ optional arguments:\n\
Version: %s\n\ Version: %s\n\
License: BSD 2-Clause\n\ License: BSD 2-Clause\n\
Webpage: https://github.com/jarun/nnn\n", VERSION); Webpage: https://github.com/jarun/nnn\n", VERSION);
exit(0); exit(0);
} }
@ -2525,13 +2524,6 @@ main(int argc, char *argv[])
} }
} }
/* Set the word shift */
_WSHIFT = sizeof(ulong);
if (_WSHIFT == 8)
_WSHIFT = 3;
else
_WSHIFT = 2;
/* Increase current open file descriptor limit */ /* Increase current open file descriptor limit */
open_max = max_openfds(); open_max = max_openfds();