Remove clamping from AddDaysImpl and AddWeeksImpl; fix 01921_datatype_date32 test

This commit is contained in:
Roman Vasin 2022-08-10 08:14:16 +00:00
parent 96598e3574
commit 537ba613dc
2 changed files with 8 additions and 8 deletions

View File

@ -288,12 +288,12 @@ struct AddDaysImpl
static inline NO_SANITIZE_UNDEFINED UInt16 execute(UInt16 d, Int64 delta, const DateLUTImpl &, UInt16 = 0)
{
return static_cast<UInt16>(std::clamp(d + delta, 0L, 65535L));
return d + delta;
}
static inline NO_SANITIZE_UNDEFINED Int32 execute(Int32 d, Int64 delta, const DateLUTImpl &, UInt16 = 0)
{
return std::max(static_cast<Int32>(d + delta), -static_cast<Int32>(DateLUT::instance().getDayNumOffsetEpoch()));
return d + delta;
}
};
@ -322,12 +322,12 @@ struct AddWeeksImpl
static inline NO_SANITIZE_UNDEFINED UInt16 execute(UInt16 d, Int32 delta, const DateLUTImpl &, UInt16 = 0)
{
return static_cast<UInt16>(std::clamp(d + delta * 7, 0, 65535));
return d + delta * 7;
}
static inline NO_SANITIZE_UNDEFINED Int32 execute(Int32 d, Int32 delta, const DateLUTImpl &, UInt16 = 0)
{
return std::max(static_cast<Int32>(d + delta * 7), -static_cast<Int32>(DateLUT::instance().getDayNumOffsetEpoch()));
return d + delta * 7;
}
};

View File

@ -248,14 +248,14 @@
2299-12-30 23:00:00.000
2021-06-21 23:00:00.000
-------subtractDays---------
1900-01-01
1900-01-01
2299-12-31
2299-12-31
2299-12-08
2299-12-24
2021-06-15
-------subtractWeeks---------
1900-01-01
1900-01-01
2299-12-31
2299-12-31
2299-12-08
2299-12-24
2021-06-15