From dbad5988402c39a712dc8798b066380e6b5b1116 Mon Sep 17 00:00:00 2001 From: Leon Sha Date: Fri, 14 Oct 2011 13:12:46 +0800 Subject: [PATCH] Bug 694256 - Build error: JS_FloorLog2 is missing. r=luke. --- js/public/Utility.h | 2 +- js/src/jslog2.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js/public/Utility.h b/js/public/Utility.h index 0e44ccae802..1de9eb499a8 100644 --- a/js/public/Utility.h +++ b/js/public/Utility.h @@ -346,7 +346,7 @@ __BitScanReverse64(unsigned __int64 val) # define js_FloorLog2wImpl(n) \ ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n))) # else -# define js_FloorLog2wImpl(n) ((size_t)JS_FloorLog2(n)) +extern size_t js_FloorLog2wImpl(size_t n); # endif #elif JS_BYTES_PER_WORD == 8 # ifdef JS_HAS_BUILTIN_BITSCAN64 diff --git a/js/src/jslog2.cpp b/js/src/jslog2.cpp index 39f30385686..2c6e5641c44 100644 --- a/js/src/jslog2.cpp +++ b/js/src/jslog2.cpp @@ -54,6 +54,17 @@ JS_STATIC_ASSERT_IF(JS_BYTES_PER_WORD == 8, sizeof(unsigned long long) == sizeof(JSUword)); #endif +#if !defined(JS_HAS_BUILTIN_BITSCAN32) && JS_BYTES_PER_WORD == 4 + +size_t +js_FloorLog2wImpl(size_t n) +{ + size_t log2; + + JS_FLOOR_LOG2(log2, n); + return log2; +} +#endif /* * js_FloorLog2wImpl has to be defined only for 64-bit non-GCC case. */