Skip to content

Commit 2a32d96

Browse files
backesCommit Bot
authored andcommitted
[utils] Remove BoolToInt helper
This function is trivial, can and be inlined to the single use. This makes utils.h a tiny little bit smaller. R=verwaest@chromium.org Bug: v8:9810, v8:8912 Change-Id: I877f3713530644a1cb9e0f286cf87f55072d33da Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1903444 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#64850}
1 parent 77a2b4c commit 2a32d96

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/date/date.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ void DateCache::YearMonthDayFromDays(int days, int* year, int* month,
128128
days += is_leap;
129129

130130
// Check if the date is after February.
131-
if (days >= 31 + 28 + BoolToInt(is_leap)) {
132-
days -= 31 + 28 + BoolToInt(is_leap);
131+
if (days >= 31 + 28 + (is_leap ? 1 : 0)) {
132+
days -= 31 + 28 + (is_leap ? 1 : 0);
133133
// Find the date starting from March.
134134
for (int i = 2; i < 12; i++) {
135135
if (days < kDaysInMonths[i]) {

src/utils/utils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ inline char HexCharOfValue(int value) {
5353
return value - 10 + 'A';
5454
}
5555

56-
inline int BoolToInt(bool b) { return b ? 1 : 0; }
57-
5856
// Checks if value is in range [lower_limit, higher_limit] using a single
5957
// branch.
6058
template <typename T, typename U>

0 commit comments

Comments
 (0)