Bug 694256 - Build error: JS_FloorLog2 is missing. r=luke.
authorLeon Sha <leon.sha@oracle.com>
Fri, 14 Oct 2011 13:12:46 +0800
changeset 80075 aa2e380c86fb21743b7e627687357fc06761a84b
parent 80071 d2a037d0354d354b2d683518ce5c6c297d1b7af8
child 80076 56c7568767f18154d266287d6ba03264602a3133
push idunknown
push userunknown
push dateunknown
reviewersluke
bugs694256
milestone10.0a1
Bug 694256 - Build error: JS_FloorLog2 is missing. r=luke.
js/public/Utility.h
js/src/jslog2.cpp
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -341,17 +341,17 @@ unsigned char _BitScanReverse64(unsigned
  */
 #define JS_FLOOR_LOG2W(n) (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n))
 
 #if JS_BYTES_PER_WORD == 4
 # ifdef JS_HAS_BUILTIN_BITSCAN32
 #  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
 #  define js_FloorLog2wImpl(n)                                                \
     ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n)))
 # else
 extern size_t js_FloorLog2wImpl(size_t n);
 # endif
--- a/js/src/jslog2.cpp
+++ b/js/src/jslog2.cpp
@@ -49,16 +49,27 @@ JS_STATIC_ASSERT(sizeof(unsigned int) ==
 JS_STATIC_ASSERT_IF(JS_BYTES_PER_WORD == 4,
                     sizeof(unsigned int) == sizeof(JSUword));
 #endif
 #ifdef JS_HAS_BUILTIN_BITSCAN64
 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.
  */
 #if !defined(JS_HAS_BUILTIN_BITSCAN64) && JS_BYTES_PER_WORD == 8
 
 size_t
 js_FloorLog2wImpl(size_t n)
 {