Lines Matching refs:Src
13 #include "src/base/logging.h"
14 #include "src/base/macros.h"
36 // A range for a given nunmeric Src type is contained for a given numeric Dst
37 // type if both numeric_limits<Src>::max() <= numeric_limits<Dst>::max() and
38 // numeric_limits<Src>::min() >= numeric_limits<Dst>::min() are true.
51 typename Src,
56 std::numeric_limits<Src>::is_signed
61 // Same sign: Dst is guaranteed to contain Src only if its range is equal or
63 template <typename Dst, typename Src, IntegerRepresentation Sign>
64 struct StaticDstRangeRelationToSrcRange<Dst, Src, Sign, Sign> {
66 MaxExponent<Dst>::value >= MaxExponent<Src>::value
73 template <typename Dst, typename Src>
75 Src,
79 MaxExponent<Dst>::value > MaxExponent<Src>::value
84 // Signed to unsigned: Dst cannot be statically determined to contain Src.
85 template <typename Dst, typename Src>
87 Src,
118 typename Src,
122 IntegerRepresentation SrcSign = std::numeric_limits<Src>::is_signed
126 StaticDstRangeRelationToSrcRange<Dst, Src>::value >
133 // Dst range is statically determined to contain Src: Nothing to check.
135 typename Src,
139 Src,
143 static RangeConstraint Check(Src value) { return RANGE_VALID; }
148 template <typename Dst, typename Src>
150 Src,
154 static RangeConstraint Check(Src value) {
164 template <typename Dst, typename Src>
166 Src,
170 static RangeConstraint Check(Src value) {
176 template <typename Dst, typename Src>
178 Src,
182 static RangeConstraint Check(Src value) {
183 return sizeof(Dst) > sizeof(Src)
186 value <= static_cast<Src>(std::numeric_limits<Dst>::max()),
193 template <typename Dst, typename Src>
195 Src,
199 static RangeConstraint Check(Src value) {
200 return (MaxExponent<Dst>::value >= MaxExponent<Src>::value)
201 ? GetRangeConstraint(true, value >= static_cast<Src>(0))
203 value <= static_cast<Src>(std::numeric_limits<Dst>::max()),
204 value >= static_cast<Src>(0));
208 template <typename Dst, typename Src>
209 inline RangeConstraint DstRangeRelationToSrcRange(Src value) {
211 STATIC_ASSERT(std::numeric_limits<Src>::is_specialized);
213 return DstRangeRelationToSrcRangeImpl<Dst, Src>::Check(value);