mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Avoid implicit conversion clang-tidy warnings in AK::Time
This commit is contained in:
parent
2c4f7fae1e
commit
2b16ee742e
Notes:
sideshowbarker
2024-07-18 01:07:43 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/2b16ee742e8 Pull-request: https://github.com/SerenityOS/serenity/pull/10737 Reviewed-by: https://github.com/BenWiederhake Reviewed-by: https://github.com/PeterBindels-TomTom Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/dascandy Reviewed-by: https://github.com/trflynn89
1 changed files with 5 additions and 4 deletions
|
@ -115,9 +115,9 @@ private:
|
|||
i64 numerator_64 = numerator;
|
||||
i64 dividend = sane_mod(numerator_64, denominator);
|
||||
// Does not underflow: numerator can only become smaller.
|
||||
numerator = numerator_64;
|
||||
numerator = static_cast<i32>(numerator_64);
|
||||
// Does not overflow: Will be smaller than original value of 'numerator'.
|
||||
return dividend;
|
||||
return static_cast<i32>(dividend);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -139,9 +139,10 @@ public:
|
|||
}
|
||||
[[nodiscard]] static Time from_timespec(const struct timespec&);
|
||||
[[nodiscard]] static Time from_timeval(const struct timeval&);
|
||||
[[nodiscard]] constexpr static Time min() { return Time(-0x8000'0000'0000'0000LL, 0); };
|
||||
// We don't pull in <stdint.h> for the pretty min/max definitions because this file is also included in the Kernel
|
||||
[[nodiscard]] constexpr static Time min() { return Time(-__INT64_MAX__ - 1LL, 0); };
|
||||
[[nodiscard]] constexpr static Time zero() { return Time(0, 0); };
|
||||
[[nodiscard]] constexpr static Time max() { return Time(0x7fff'ffff'ffff'ffffLL, 999'999'999); };
|
||||
[[nodiscard]] constexpr static Time max() { return Time(__INT64_MAX__, 999'999'999); };
|
||||
|
||||
#ifndef KERNEL
|
||||
[[nodiscard]] static Time now_realtime();
|
||||
|
|
Loading…
Reference in a new issue