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

Unified Diff: Source/platform/fonts/SimpleFontData.cpp

Issue 227473005: Performance related change, Optimization for / and % operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Commet fixes Created 6 years, 8 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 | « Source/platform/fonts/GlyphPage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/SimpleFontData.cpp
diff --git a/Source/platform/fonts/SimpleFontData.cpp b/Source/platform/fonts/SimpleFontData.cpp
index da13c13985b10d54f2ae08a6f0b9b2a019ead071..849e889a0c0a0e787474f7f0c507c433eaaf4830 100644
--- a/Source/platform/fonts/SimpleFontData.cpp
+++ b/Source/platform/fonts/SimpleFontData.cpp
@@ -160,8 +160,9 @@ const SimpleFontData* SimpleFontData::fontDataForCharacter(UChar32) const
Glyph SimpleFontData::glyphForCharacter(UChar32 character) const
{
- GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, character / GlyphPage::size);
- return node->page() ? node->page()->glyphAt(character % GlyphPage::size) : 0;
+ // As GlyphPage::size is power of 2 so shifting is valid
+ GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, character >> GlyphPage::sizeBits);
+ return node->page() ? node->page()->glyphAt(character & 0xFF) : 0;
}
bool SimpleFontData::isSegmented() const
« no previous file with comments | « Source/platform/fonts/GlyphPage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698