msvcp: Use BitScanReverse in log2i.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3fc7475283
commit
03b4bffbbb
|
@ -1889,37 +1889,12 @@ typedef struct compact_block
|
||||||
int size_check;
|
int size_check;
|
||||||
}compact_block;
|
}compact_block;
|
||||||
|
|
||||||
/* based on wined3d_log2i from wined3d.h */
|
|
||||||
/* Return the integer base-2 logarithm of (x|1). Result is 0 for x == 0. */
|
/* Return the integer base-2 logarithm of (x|1). Result is 0 for x == 0. */
|
||||||
static inline unsigned int log2i(unsigned int x)
|
static inline unsigned int log2i(unsigned int x)
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
|
unsigned int index;
|
||||||
return __builtin_clz(x|1) ^ 0x1f;
|
BitScanReverse(&index, x|1);
|
||||||
#else
|
return index;
|
||||||
static const unsigned int l[] =
|
|
||||||
{
|
|
||||||
~0u, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
||||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
||||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
|
||||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
|
||||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
|
||||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
|
||||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
|
||||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
||||||
};
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
x |= 1;
|
|
||||||
return (i = x >> 16) ? (x = i >> 8) ? l[x] + 24 : l[i] + 16 : (i = x >> 8) ? l[i] + 8 : l[x];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KAII@Z */
|
/* ?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KAII@Z */
|
||||||
|
|
Loading…
Reference in New Issue