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}
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]) {
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) {
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;
// 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);