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

Unified Diff: Source/core/platform/Length.h

Issue 14283003: Micro-optimise Length::initFromLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/Length.h
diff --git a/Source/core/platform/Length.h b/Source/core/platform/Length.h
index 9e95cf8504839efefad2947b5d92d6e5c6190247..12c4902618b847a2a126fc9e42fa79caeda33d27 100644
--- a/Source/core/platform/Length.h
+++ b/Source/core/platform/Length.h
@@ -30,6 +30,7 @@
#include <wtf/HashMap.h>
#include <wtf/MathExtras.h>
#include <wtf/PassOwnArrayPtr.h>
+#include <cstring>
namespace WebCore {
@@ -283,15 +284,8 @@ private:
}
void initFromLength(const Length &length)
{
- m_quirk = length.m_quirk;
- m_type = length.m_type;
- m_isFloat = length.m_isFloat;
-
- if (m_isFloat)
- m_floatValue = length.m_floatValue;
- else
- m_intValue = length.m_intValue;
-
+ memcpy(this, &length, sizeof(Length));
+
if (isCalculated())
incrementCalculatedRef();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698