diff --git a/vis/vis.cc b/vis/vis.cc index e88b8a1c..00398d98 100644 --- a/vis/vis.cc +++ b/vis/vis.cc @@ -2,6 +2,7 @@ #include #include +#include // for std::countr_zero #include #include @@ -11,22 +12,6 @@ #include #include -/* Use some GCC builtins */ -#if !defined(ffsl) && defined(__GNUC__) -#define ffsl __builtin_ffsl -#elif defined(_WIN32) -#include -inline int ffsl(long int val) -{ - unsigned long indexout; - unsigned char res = _BitScanForward(&indexout, val); - if (!res) - return 0; - else - return indexout + 1; -} -#endif - /* * If the portal file is "PRT2" format, then the leafs we are dealing with are * really clusters of leaves. So, after the vis job is done we need to expand @@ -357,7 +342,7 @@ static void PortalCompleted(visportal_t *completed) * Update mightsee for any of the changed bits that survived */ while (changed) { - bit = ffsl(changed) - 1; + bit = std::countr_zero(changed); changed &= ~nth_bit(bit); leafnum = (j << leafbits_t::shift) + bit; UpdateMightsee(leafs[leafnum], myleaf);