Skip to content

Commit ac9f760

Browse files
committed
daysmask_set_range
1 parent 6857cec commit ac9f760

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/libical/icalrecur.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,11 @@ static void daysmask_set_range(unsigned long days[], int fromDayIncl, int untilD
11341134
int fromBitIdx = fromDayIncl + ICAL_YEARDAYS_MASK_OFFSET;
11351135
int untilBitIdx = untilDayExcl + ICAL_YEARDAYS_MASK_OFFSET;
11361136

1137-
for (
1138-
int word_idx = fromBitIdx / BITS_PER_LONG;
1139-
word_idx < (int)((untilBitIdx + BITS_PER_LONG - 1) / BITS_PER_LONG);
1140-
word_idx++) {
1141-
int lowerBitIdxIncl = MAX(0, fromBitIdx - (int)(word_idx * BITS_PER_LONG));
1142-
int upperBitIdxExcl = MIN((int)BITS_PER_LONG, untilBitIdx - (int)(word_idx * BITS_PER_LONG));
1137+
for (int word_idx = fromBitIdx / BITS_PER_LONG;
1138+
word_idx < (int)((untilBitIdx + BITS_PER_LONG - 1) / BITS_PER_LONG);
1139+
word_idx++) {
1140+
int lowerBitIdxIncl = (fromBitIdx <= (int)(word_idx * BITS_PER_LONG)) ? 0 : fromBitIdx - (int)(word_idx * BITS_PER_LONG);
1141+
int upperBitIdxExcl = (untilBitIdx >= (int)((word_idx + 1) * BITS_PER_LONG)) ? (int)BITS_PER_LONG : (int)(untilBitIdx - (int)((word_idx + 1) * BITS_PER_LONG));
11431142

11441143
unsigned long mask = (unsigned long)-1;
11451144
if (lowerBitIdxIncl > 0)

0 commit comments

Comments
 (0)