10 #if !defined(SG14_FIXED_POINT_COMMON_TYPE_H) 11 #define SG14_FIXED_POINT_COMMON_TYPE_H 1 13 #include "fixed_point_type.h" 28 template<
class Lhs,
class Rhs,
class _Enable =
void>
29 struct common_type_mixed;
33 template<
class LhsRep,
int LhsExponent,
class RhsInteger>
34 struct common_type_mixed<fixed_point
35 <LhsRep, LhsExponent>, RhsInteger, _impl::enable_if_t<std::numeric_limits<RhsInteger>::is_integer>> : std::common_type<
36 fixed_point<LhsRep, LhsExponent>, fixed_point<RhsInteger, 0>> {
41 template<
class LhsRep,
int LhsExponent,
class Float>
42 struct common_type_mixed<
43 fixed_point<LhsRep, LhsExponent>, Float,
44 _impl::enable_if_t<std::is_floating_point<Float>::value>>
45 : std::common_type<_impl::fp::float_of_same_size<LhsRep>, Float> {
57 template<
class Rep,
int Exponent>
58 struct common_type<
sg14::fixed_point<Rep, Exponent>> {
60 typename std::common_type<Rep>::type,
65 template<
class LhsRep,
int LhsExponent,
class Rhs>
66 struct common_type<
sg14::fixed_point<LhsRep, LhsExponent>, Rhs> {
67 static_assert(!sg14::_impl::is_fixed_point<Rhs>::value,
"fixed-point Rhs type");
68 using type =
typename sg14::_impl::fp::ct::common_type_mixed<sg14::fixed_point<LhsRep, LhsExponent>, Rhs>::type;
72 template<
class Lhs,
class RhsRep,
int RhsExponent>
73 struct common_type<Lhs,
sg14::fixed_point<RhsRep, RhsExponent>> {
74 static_assert(!sg14::_impl::is_fixed_point<Lhs>::value,
"fixed-point Lhs type");
75 using type =
typename sg14::_impl::fp::ct::common_type_mixed<sg14::fixed_point<RhsRep, RhsExponent>, Lhs>::type;
79 template<
class LhsRep,
int LhsExponent,
class RhsRep,
int RhsExponent>
85 #endif // SG14_FIXED_POINT_COMMON_TYPE_H
literal real number approximation that uses fixed-point arithmetic
Definition: fixed_point_type.h:20
study group 14 of the C++ working group
Definition: const_integer.h:22