* syscall.cc (ffs): Fix crash of ffs (0x80000000) on 64 bit.

This commit is contained in:
Corinna Vinschen 2014-10-08 16:34:31 +00:00
parent 2bf7d695ea
commit 2fb56bbfaa
2 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2014-10-08 Christian Franke <franke@computer.org>
* syscall.cc (ffs): Fix crash of ffs (0x80000000) on 64 bit.
2014-10-08 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (format_process_statm): Fix output of dirty

View File

@ -3847,10 +3847,9 @@ ffs (int i)
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
};
unsigned long int a;
unsigned long int x = i & -i;
unsigned x = i & -i;
a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ? 16 : 24);
int a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ? 16 : 24);
return table[x >> a] + a;
}