Lines Matching refs:Source
89 template <class Dest, class Source>
90 inline Dest bit_cast(const Source& source) { in bit_cast()
93 static_assert(sizeof(Dest) == sizeof(Source), "sizes should be equal"); in bit_cast()
101 template <typename Dest, typename Source>
102 constexpr Dest dchecked_integral_cast(Source source) { in dchecked_integral_cast()
106 static_cast<intmax_t>(std::numeric_limits<Source>::min()) || in dchecked_integral_cast()
107 source >= static_cast<Source>(std::numeric_limits<Dest>::min())) && in dchecked_integral_cast()
110 static_cast<uintmax_t>(std::numeric_limits<Source>::max()) || in dchecked_integral_cast()
111 source <= static_cast<Source>(std::numeric_limits<Dest>::max()))) in dchecked_integral_cast()
123 template <typename Dest, typename Source>
125 typename std::enable_if<!std::is_enum<Source>::value, Dest>::type
126 enum_cast(Source value) { in enum_cast()
131 template <typename Dest = void, typename Source>
133 typename std::enable_if<std::is_enum<Source>::value,
135 std::underlying_type<Source>,
137 enum_cast(Source value) { in enum_cast()
139 std::underlying_type<Source>, in enum_cast()
142 static_cast<typename std::underlying_type<Source>::type>(value)); in enum_cast()
148 template <typename Dest, typename Source>
149 inline Dest reinterpret_cast64(Source source) { in reinterpret_cast64()
151 static_assert(std::is_same<Source, int64_t>::value || std::is_same<Source, uint64_t>::value, in reinterpret_cast64()
155 DCHECK_EQ(static_cast<Source>(static_cast<uintptr_t>(source)), source); in reinterpret_cast64()
159 template <typename Dest, typename Source>
160 inline Dest reinterpret_cast64(Source* ptr) { in reinterpret_cast64()
171 template <typename Dest, typename Source>
172 inline Dest reinterpret_cast32(Source source) { in reinterpret_cast32()
174 static_assert(std::is_same<Source, int32_t>::value || std::is_same<Source, uint32_t>::value, in reinterpret_cast32()
178 static_assert(sizeof(uintptr_t) >= sizeof(Source), "Expecting at least 32-bit pointers."); in reinterpret_cast32()
182 template <typename Dest, typename Source>
183 inline Dest reinterpret_cast32(Source* ptr) { in reinterpret_cast32()