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

Unified Diff: fpdfsdk/javascript/JS_Value.cpp

Issue 1814233005: Make a few more const tables smaller. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: format Created 4 years, 9 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 | « core/include/fxcrt/fx_arb.h ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/JS_Value.cpp
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 8e5e463e61c26db1b1dbf87154df71ab0cbf0632..1da1525d09d6ecb587052d2c95a528d7e1eda7cc 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -653,14 +653,13 @@ double _TimeFromYear(int y) {
return 86400000.0 * _DayFromYear(y);
}
+static const uint16_t daysMonth[12] = {0, 31, 59, 90, 120, 151,
+ 181, 212, 243, 273, 304, 334};
+static const uint16_t leapDaysMonth[12] = {0, 31, 60, 91, 121, 152,
+ 182, 213, 244, 274, 305, 335};
+
double _TimeFromYearMonth(int y, int m) {
- static int daysMonth[12] = {0, 31, 59, 90, 120, 151,
- 181, 212, 243, 273, 304, 334};
- static int leapDaysMonth[12] = {0, 31, 60, 91, 121, 152,
- 182, 213, 244, 274, 305, 335};
- int* pMonth = daysMonth;
- if (_isLeapYear(y))
- pMonth = leapDaysMonth;
+ const uint16_t* pMonth = _isLeapYear(y) ? leapDaysMonth : daysMonth;
return _TimeFromYear(y) + ((double)pMonth[m]) * 86400000;
}
« no previous file with comments | « core/include/fxcrt/fx_arb.h ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698