def _generate_range_overflow_safe_signed(endpoint, periods, stride, side):
assert side in ['<STR_LIT:start>', '<STR_LIT:end>']<EOL>if side == '<STR_LIT:end>':<EOL><INDENT>stride *= -<NUM_LIT:1><EOL><DEDENT>with np.errstate(over="<STR_LIT>"):<EOL><INDENT>addend = np.int64(periods) * np.int64(stride)<EOL>try:<EOL><INDENT>return np.int64(endpoint) + addend<EOL><DEDENT>except (FloatingPointError, OverflowError):<EOL><INDENT>pass<EOL><DEDENT>assert (stride > <NUM_LIT:0> and endpoint >= <NUM_LIT:0>) or (stride < <NUM_LIT:0> and endpoint <= <NUM_LIT:0>)<EOL>if stride > <NUM_LIT:0>:<EOL><INDENT>assert endpoint >= <NUM_LIT:0><EOL>result = np.uint64(endpoint) + np.uint64(addend)<EOL>i64max = np.uint64(np.iinfo(np.int64).max)<EOL>assert result > i64max<EOL>if result <= i64max + np.uint64(stride):<EOL><INDENT>return result<EOL><DEDENT><DEDENT><DEDENT>raise OutOfBoundsDatetime('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(side=side, endpoint=endpoint,<EOL>periods=periods))<EOL>
A special case for _generate_range_overflow_safe where `periods * stride`
can be calculated without overflowing int64 bounds.