Skip to content

Commit 3838b94

Browse files
committed
Fixing Windows build
1 parent f2e62bb commit 3838b94

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/packedrow.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ void PackedRow::get_reason(
7777
tmp_col2.set_and(*this, cols_vals);
7878
for (int i = 0; i < size; i++) if (mp[i]) {
7979
int64_t tmp = mp[i];
80-
int at = __builtin_ffsll(tmp);
80+
unsigned long at;
81+
#ifdef _MSC_VER
82+
unsigned char ret = _BitScanForward64(&at, tmp);
83+
at++;
84+
if (!ret) at = 0;
85+
#else
86+
at = __builtin_ffsll(tmp);
87+
#endif
8188
int extra = 0;
8289
while (at != 0) {
8390
uint32_t col = extra + at-1 + i*64;
@@ -98,7 +105,13 @@ void PackedRow::get_reason(
98105
break;
99106

100107
tmp >>= at;
108+
#ifdef _MSC_VER
109+
unsigned char ret = _BitScanForward64(&at, tmp);
110+
at++;
111+
if (!ret) at = 0;
112+
#else
101113
at = __builtin_ffsll(tmp);
114+
#endif
102115
}
103116
}
104117

0 commit comments

Comments
 (0)