- if (sizeof start < sizeof range)
- {
- regoff_t length_offset = length;
- regoff_t start_offset = start;
- if (BE (length_offset - start_offset < range, 0))
- last_start = length;
- else if (BE (range < - start_offset, 0))
- last_start = 0;
- }
- else
- {
- if (BE ((last_start < start) != (range < 0), 0))
- {
- /* Overflow occurred when computing last_start; substitute
- the extreme value. */
- last_start = range < 0 ? 0 : length;
- }
- else
- {
- if (BE (length < last_start, 0))
- last_start = length;
- else if (BE (last_start < 0, 0))
- last_start = 0;
- }
- }
+ if (BE (length < last_start || (0 <= range && last_start < start), 0))
+ last_start = length;
+ else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0))
+ last_start = 0;