From 7213b226d78032b18dd0b679894f346d534b0198 Mon Sep 17 00:00:00 2001 From: fengyichui Date: Thu, 15 Nov 2018 17:14:29 +0800 Subject: [PATCH 1/3] Fix BLK_SHIFT may be wrong in some platforms #128 --- src/nnn.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 1bc9385..047c0ae 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -417,6 +417,18 @@ static uchar crc8fast(uchar const message[], size_t n) return remainder; } +/* Get platform block shift */ +static int get_blk_shift(void) +{ + int shift; + for (shift = 0; shift < 32; ++shift) + { + if ((1< Date: Thu, 15 Nov 2018 17:56:35 +0800 Subject: [PATCH 2/3] Fix BLK_SHIFT may be wrong in some platforms #128 --- src/nnn.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 047c0ae..80874bb 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -417,18 +417,6 @@ static uchar crc8fast(uchar const message[], size_t n) return remainder; } -/* Get platform block shift */ -static int get_blk_shift(void) -{ - int shift; - for (shift = 0; shift < 32; ++shift) - { - if ((1< Date: Thu, 15 Nov 2018 20:53:25 +0800 Subject: [PATCH 3/3] Initialize BLK_SHIFT with '-S' option --- src/nnn.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 80874bb..e59789f 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3399,9 +3399,6 @@ int main(int argc, char *argv[]) char *ipath = NULL; int opt; - // Get platform block shift - BLK_SHIFT = ffs(S_BLKSIZE) - 1; - /* Confirm we are in a terminal */ if (!isatty(0) || !isatty(1)) { fprintf(stderr, "stdin or stdout is not a tty\n"); @@ -3413,6 +3410,7 @@ int main(int argc, char *argv[]) case 'S': cfg.blkorder = 1; nftw_fn = sum_bsizes; + BLK_SHIFT = ffs(S_BLKSIZE) - 1; break; case 'l': cfg.showdetail = 0;