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
20
20
ForceYes = 1 ,
21
21
};
22
22
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
-
38
23
// / @brief This class represents a measure of time defined by a value and rate.
39
24
class RationalTime
40
25
{
@@ -419,6 +404,23 @@ class RationalTime
419
404
friend class TimeRange ;
420
405
421
406
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
+ }
422
424
};
423
425
424
426
}} // namespace opentime::OPENTIME_VERSION
Original file line number Diff line number Diff line change @@ -441,6 +441,23 @@ class TimeRange
441
441
{
442
442
return rhs - lhs >= epsilon;
443
443
}
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
+ }
444
461
};
445
462
446
463
}} // namespace opentime::OPENTIME_VERSION
You can’t perform that action at this time.
0 commit comments