mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 557270 - on s390 pointers are 31-bits, have JS_CEILING_LOG2W use size_t instead of JSUword (r=brendan)
--HG-- extra : rebase_source : cf0f82a63a0d36f84470bfd1aa99c2917cbc5c95
This commit is contained in:
parent
3a1a494d96
commit
6b6463a8e6
@ -213,8 +213,8 @@ __BitScanReverse64(unsigned __int64 val)
|
||||
|
||||
/*
|
||||
* Internal function.
|
||||
* Compute the log of the least power of 2 greater than or equal to n.
|
||||
* This is a version of JS_CeilingLog2 that operates on jsuword with
|
||||
* Compute the log of the least power of 2 greater than or equal to n. This is
|
||||
* a version of JS_CeilingLog2 that operates on unsigned integers with
|
||||
* CPU-dependant size.
|
||||
*/
|
||||
#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1))
|
||||
@ -222,7 +222,7 @@ __BitScanReverse64(unsigned __int64 val)
|
||||
/*
|
||||
* Internal function.
|
||||
* Compute the log of the greatest power of 2 less than or equal to n.
|
||||
* This is a version of JS_FloorLog2 that operates on jsuword with
|
||||
* This is a version of JS_FloorLog2 that operates on unsigned integers with
|
||||
* CPU-dependant size and requires that n != 0.
|
||||
*/
|
||||
#define JS_FLOOR_LOG2W(n) (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n))
|
||||
@ -231,18 +231,18 @@ __BitScanReverse64(unsigned __int64 val)
|
||||
|
||||
# ifdef JS_HAS_BUILTIN_BITSCAN32
|
||||
# define js_FloorLog2wImpl(n) \
|
||||
((JSUword)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n)))
|
||||
((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n)))
|
||||
# else
|
||||
# define js_FloorLog2wImpl(n) ((JSUword)JS_FloorLog2(n))
|
||||
# define js_FloorLog2wImpl(n) ((size_t)JS_FloorLog2(n))
|
||||
#endif
|
||||
|
||||
#elif JS_BYTES_PER_WORD == 8
|
||||
|
||||
# ifdef JS_HAS_BUILTIN_BITSCAN64
|
||||
# define js_FloorLog2wImpl(n) \
|
||||
((JSUword)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n)))
|
||||
((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n)))
|
||||
# else
|
||||
extern JSUword js_FloorLog2wImpl(JSUword n);
|
||||
extern size_t js_FloorLog2wImpl(size_t n);
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
@ -85,10 +85,10 @@ JS_FloorLog2(JSUint32 n)
|
||||
*/
|
||||
#if !defined(JS_HAS_BUILTIN_BITSCAN64) && JS_BYTES_PER_WORD == 8
|
||||
|
||||
JSUword
|
||||
js_FloorLog2wImpl(JSUword n)
|
||||
size_t
|
||||
js_FloorLog2wImpl(size_t n)
|
||||
{
|
||||
JSUword log2, m;
|
||||
size_t log2, m;
|
||||
|
||||
JS_ASSERT(n != 0);
|
||||
|
||||
|
@ -206,7 +206,7 @@ class ReentrancyGuard
|
||||
JS_ALWAYS_INLINE size_t
|
||||
RoundUpPow2(size_t x)
|
||||
{
|
||||
typedef tl::StaticAssert<tl::IsSameType<size_t,JSUword>::result>::result _;
|
||||
typedef tl::StaticAssert<tl::IsSameType<size_t,JSSize>::result>::result _;
|
||||
size_t log2 = JS_CEILING_LOG2W(x);
|
||||
JS_ASSERT(log2 < tl::BitSize<size_t>::result);
|
||||
size_t result = size_t(1) << log2;
|
||||
|
Loading…
Reference in New Issue
Block a user