aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r--coreutils/ls.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index e7544474b..6c898b793 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -509,15 +509,10 @@ static int sortcmp(const void *a, const void *b)
509 509
510 /* Make dif fit into an int */ 510 /* Make dif fit into an int */
511 if (sizeof(dif) > sizeof(int)) { 511 if (sizeof(dif) > sizeof(int)) {
512 if (sizeof(dif) == sizeof(int)*2) { 512 enum { BITS_TO_SHIFT = 8 * (sizeof(dif) - sizeof(int)) };
513 /* typical on many arches */ 513 /* shift leaving only "int" worth of bits */
514 if (dif != 0) { 514 if (dif != 0) {
515 dif = 1 | (int)((uoff_t)dif >> (sizeof(int)*8)); 515 dif = 1 | (int)((uoff_t)dif >> BITS_TO_SHIFT);
516 }
517 } else {
518 while ((dif & ~(off_t)INT_MAX) != 0) {
519 dif >>= (sizeof(int)*8 / 2);
520 }
521 } 516 }
522 } 517 }
523 518