We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 54bcc0b commit 932709bCopy full SHA for 932709b
common.h
@@ -17,6 +17,11 @@ static inline int ilog2(int x)
17
return 31 - __builtin_clz(x | 1);
18
}
19
20
+static inline int ffs(int x)
21
+{
22
+ return __builtin_ffs(x);
23
+}
24
+
25
/* Range check
26
* For any variable range checking:
27
* if (x >= minx && x <= maxx) ...
riscv.c
@@ -806,7 +806,7 @@ void vm_step(hart_t *vm)
806
vm->current_pc = vm->pc;
807
if ((vm->sstatus_sie || !vm->s_mode) && (vm->sip & vm->sie)) {
808
uint32_t applicable = (vm->sip & vm->sie);
809
- uint8_t idx = __builtin_ffs(applicable) - 1;
+ uint8_t idx = ffs(applicable) - 1;
810
if (idx == 1) {
811
emu_state_t *data = PRIV(vm);
812
data->clint.msip[vm->mhartid] = 0;
0 commit comments