Commit 6ad8702a77edbc2f4da9ae9424c65c2c8c9bf7ed

Authored by Jan Kiszka
Committed by Blue Swirl
1 parent 1447379b

Use ctz64 in favor of ffsll

Not all host platforms support ffsll.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Showing 1 changed file with 4 additions and 3 deletions
target-i386/machine.c
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 #include "hw/boards.h" 2 #include "hw/boards.h"
3 #include "hw/pc.h" 3 #include "hw/pc.h"
4 #include "hw/isa.h" 4 #include "hw/isa.h"
  5 +#include "host-utils.h"
5 6
6 #include "exec-all.h" 7 #include "exec-all.h"
7 #include "kvm.h" 8 #include "kvm.h"
@@ -148,9 +149,9 @@ void cpu_save(QEMUFile *f, void *opaque) @@ -148,9 +149,9 @@ void cpu_save(QEMUFile *f, void *opaque)
148 to find it and save its number instead (-1 for none). */ 149 to find it and save its number instead (-1 for none). */
149 pending_irq = -1; 150 pending_irq = -1;
150 for (i = 0; i < ARRAY_SIZE(env->interrupt_bitmap); i++) { 151 for (i = 0; i < ARRAY_SIZE(env->interrupt_bitmap); i++) {
151 - bit = ffsll(env->interrupt_bitmap[i]);  
152 - if (bit) {  
153 - pending_irq = i * 64 + bit - 1; 152 + if (env->interrupt_bitmap[i]) {
  153 + bit = ctz64(env->interrupt_bitmap[i]);
  154 + pending_irq = i * 64 + bit;
154 break; 155 break;
155 } 156 }
156 } 157 }