Commit c09b26d1 authored by Sven Panne's avatar Sven Panne

Avoid MSVC's C6323 warning (use of arithmetic operator on Boolean type)

We could use BoolToInt consistently, but for now let's just fix the warnings.

R=jochen@chromium.org

Review URL: https://codereview.chromium.org/825913005

Cr-Commit-Position: refs/heads/master@{#26037}
parent ca741a0b
......@@ -103,8 +103,8 @@ void DateCache::YearMonthDayFromDays(
days += is_leap;
// Check if the date is after February.
if (days >= 31 + 28 + is_leap) {
days -= 31 + 28 + is_leap;
if (days >= 31 + 28 + BoolToInt(is_leap)) {
days -= 31 + 28 + BoolToInt(is_leap);
// Find the date starting from March.
for (int i = 2; i < 12; i++) {
if (days < kDaysInMonths[i]) {
......
......@@ -106,7 +106,8 @@ RUNTIME_FUNCTION(Runtime_DeclareGlobals) {
bool is_var = initial_value->IsUndefined();
bool is_const = initial_value->IsTheHole();
bool is_function = initial_value->IsSharedFunctionInfo();
DCHECK(is_var + is_const + is_function == 1);
DCHECK_EQ(1,
BoolToInt(is_var) + BoolToInt(is_const) + BoolToInt(is_function));
Handle<Object> value;
if (is_function) {
......@@ -220,7 +221,8 @@ RUNTIME_FUNCTION(Runtime_DeclareLookupSlot) {
bool is_var = *initial_value == NULL;
bool is_const = initial_value->IsTheHole();
bool is_function = initial_value->IsJSFunction();
DCHECK(is_var + is_const + is_function == 1);
DCHECK_EQ(1,
BoolToInt(is_var) + BoolToInt(is_const) + BoolToInt(is_function));
int index;
PropertyAttributes attributes;
......
......@@ -27,6 +27,9 @@ namespace internal {
// General helper functions
inline int BoolToInt(bool b) { return b ? 1 : 0; }
// Same as strcmp, but can handle NULL arguments.
inline bool CStringEquals(const char* s1, const char* s2) {
return (s1 == s2) || (s1 != NULL && s2 != NULL && strcmp(s1, s2) == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment