Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: src/hydrogen-instructions.cc

Issue 15994015: Replace log2 with MostSignificantBit (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 1943cce372367efd65f79bbdf586058cece1bc03..4b1093e205b515219824ed9850fdf64370844bc5 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -2328,14 +2328,11 @@ Range* HBitwise::InferRange(Zone* zone) {
if (right_upper < 0) right_upper = ~right_upper;
if (right_lower < 0) right_lower = ~right_lower;
- // Find the highest used bit.
- int high = static_cast<int>(log2(left_upper));
- high = Max(high, static_cast<int>(log2(left_lower)));
- high = Max(high, static_cast<int>(log2(right_upper)));
- high = Max(high, static_cast<int>(log2(right_lower)));
+ int high = MostSignificantBit(
+ left_upper | left_lower | right_upper | right_lower);
int64_t limit = 1;
- limit <<= high + 1;
+ limit <<= high;
int32_t min = (left()->range()->CanBeNegative() ||
right()->range()->CanBeNegative())
? static_cast<int32_t>(-limit) : 0;
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698