diff options
author | JF Bastien <jfb@chromium.org> | 2015-12-23 16:07:43 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2015-12-23 16:07:43 -0800 |
commit | d049ae31248fd3db11717a3ea006c5d1f59c913d (patch) | |
tree | 60c61e360e5bbfd2d80862f93f5bec23372174bb /src | |
parent | cef89df8e5ad80a0fb881af31804eef854909552 (diff) | |
download | binaryen-d049ae31248fd3db11717a3ea006c5d1f59c913d.tar.gz binaryen-d049ae31248fd3db11717a3ea006c5d1f59c913d.tar.bz2 binaryen-d049ae31248fd3db11717a3ea006c5d1f59c913d.zip |
bits: return 32 on ctz32/clz32 of 0 instead of -1
Diffstat (limited to 'src')
-rw-r--r-- | src/bits.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bits.h b/src/bits.h index 0ae83db3f..98bb96a4f 100644 --- a/src/bits.h +++ b/src/bits.h @@ -81,7 +81,7 @@ template<> inline int CountTrailingZeroes<uint32_t>(uint32_t v) { }; return v ? (int)tbl[((uint32_t)((v & -(int32_t)v) * 0x077CB531U)) >> 27] : - -1; + 32; } template<> inline int CountLeadingZeroes<uint32_t>(uint32_t v) { @@ -99,7 +99,7 @@ template<> inline int CountLeadingZeroes<uint32_t>(uint32_t v) { v = v | (v >> 16); return v ? (int)tbl[((uint32_t)(v * 0x07C4ACDDU)) >> 27] : - -1; + 32; } } // namespace wasm |