We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26cdba0 commit ed555feCopy full SHA for ed555fe
src/gc.c
@@ -459,7 +459,16 @@ static __attribute__((noinline)) void *malloc_page(void)
459
heaps_lb[heap_i] = i;
460
if (heaps_ub[heap_i] < i)
461
heaps_ub[heap_i] = i;
462
- int j = (ffs(heap->freemap[i]) - 1);
+
463
+#ifdef __MINGW32__
464
+ int j = __builtin_ffs(heap->freemap[i]) - 1;
465
+#elif _MSC_VER
466
+ int j;
467
+ _BitScanForward(&j, heap->freemap[i]);
468
+#else
469
+ int j = ffs(heap->freemap[i]) - 1;
470
+#endif
471
472
heap->freemap[i] &= ~(uint32_t)(1 << j);
473
if (j == 0) { // reserve a page for metadata (every 31 data pages)
474
j++;
0 commit comments