summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2010-01-24 22:52:21 +0100
committerDenys Vlasenko2010-01-24 22:52:21 +0100
commit6b01b71e8370c58787318d5fca06db2074f95c55 (patch)
tree1f2fff69f5004a6fe66872434e1a25827588f1a7 /coreutils
parent9f93d621925966c22ee51fdcb5def8e131596f9b (diff)
downloadbusybox-6b01b71e8370c58787318d5fca06db2074f95c55.zip
busybox-6b01b71e8370c58787318d5fca06db2074f95c55.tar.gz
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index e754447..6c898b7 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -509,15 +509,10 @@ static int sortcmp(const void *a, const void *b)
/* Make dif fit into an int */
if (sizeof(dif) > sizeof(int)) {
- if (sizeof(dif) == sizeof(int)*2) {
- /* typical on many arches */
- if (dif != 0) {
- dif = 1 | (int)((uoff_t)dif >> (sizeof(int)*8));
- }
- } else {
- while ((dif & ~(off_t)INT_MAX) != 0) {
- dif >>= (sizeof(int)*8 / 2);
- }
+ enum { BITS_TO_SHIFT = 8 * (sizeof(dif) - sizeof(int)) };
+ /* shift leaving only "int" worth of bits */
+ if (dif != 0) {
+ dif = 1 | (int)((uoff_t)dif >> BITS_TO_SHIFT);
}
}