using bsr even with no popcnt present (#852)

This commit is contained in:
Alden Torres 2016-06-24 17:43:29 -04:00 committed by Arvid Norberg
parent 9efba7d752
commit c84aceea3f
1 changed files with 4 additions and 7 deletions

View File

@ -76,16 +76,13 @@ namespace libtorrent
} }
#if TORRENT_HAS_SSE #if TORRENT_HAS_SSE
if (aux::mmx_support)
{
#ifdef __GNUC__ #ifdef __GNUC__
return ret + __builtin_clz(v); return ret + __builtin_clz(v);
#else #else
DWORD pos; DWORD pos;
_BitScanReverse(&pos, v); _BitScanReverse(&pos, v);
return ret + 31 - pos; return ret + 31 - pos;
#endif #endif
}
#else #else
// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious // http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
static const int MultiplyDeBruijnBitPosition[32] = static const int MultiplyDeBruijnBitPosition[32] =