File tree Expand file tree Collapse file tree 2 files changed +34
-15
lines changed
Expand file tree Collapse file tree 2 files changed +34
-15
lines changed Original file line number Diff line number Diff line change @@ -20,21 +20,6 @@ enum IsDropFrameRate : int
2020 ForceYes = 1 ,
2121};
2222
23- // / @brief Returns the absolute value.
24- // /
25- // / \todo Document why this function is used instead of "std::fabs()".
26- constexpr double
27- fabs (double val) noexcept
28- {
29- union
30- {
31- double f;
32- uint64_t i;
33- } bits = { val };
34- bits.i &= std::numeric_limits<uint64_t >::max () / 2 ;
35- return bits.f ;
36- }
37-
3823// / @brief This class represents a measure of time defined by a value and rate.
3924class RationalTime
4025{
@@ -419,6 +404,23 @@ class RationalTime
419404 friend class TimeRange ;
420405
421406 double _value, _rate;
407+
408+ // / @brief Returns the absolute value.
409+ // /
410+ // / \todo This function is used instead of "std::fabs()" so we can mark it as
411+ // / constexpr. We can remove this and replace it with the std version when we
412+ // / upgrade to C++23. Note that there are two copies of this function, in both
413+ // / RationalTime and TimeRange.
414+ static constexpr double fabs (double val) noexcept
415+ {
416+ union
417+ {
418+ double f;
419+ uint64_t i;
420+ } bits = { val };
421+ bits.i &= std::numeric_limits<uint64_t >::max () / 2 ;
422+ return bits.f ;
423+ }
422424};
423425
424426}} // namespace opentime::OPENTIME_VERSION
Original file line number Diff line number Diff line change @@ -441,6 +441,23 @@ class TimeRange
441441 {
442442 return rhs - lhs >= epsilon;
443443 }
444+
445+ // / @brief Returns the absolute value.
446+ // /
447+ // / \todo This function is used instead of "std::fabs()" so we can mark it as
448+ // / constexpr. We can remove this and replace it with the std version when we
449+ // / upgrade to C++23. Note that there are two copies of this function, in both
450+ // / RationalTime and TimeRange.
451+ static constexpr double fabs (double val) noexcept
452+ {
453+ union
454+ {
455+ double f;
456+ uint64_t i;
457+ } bits = { val };
458+ bits.i &= std::numeric_limits<uint64_t >::max () / 2 ;
459+ return bits.f ;
460+ }
444461};
445462
446463}} // namespace opentime::OPENTIME_VERSION
You can’t perform that action at this time.
0 commit comments