Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/WebKit/Source/wtf/StdLibExtras.h

Issue 2257683002: Rename WTF::bitwise_cast to WTF::bitwiseCast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/HashFunctions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 #define reinterpret_cast_ptr reinterpret_cast 164 #define reinterpret_cast_ptr reinterpret_cast
165 #endif 165 #endif
166 166
167 namespace WTF { 167 namespace WTF {
168 168
169 /* 169 /*
170 * C++'s idea of a reinterpret_cast lacks sufficient cojones. 170 * C++'s idea of a reinterpret_cast lacks sufficient cojones.
171 */ 171 */
172 template<typename TO, typename FROM> 172 template<typename TO, typename FROM>
173 inline TO bitwise_cast(FROM from) 173 inline TO bitwiseCast(FROM from)
174 { 174 {
175 static_assert(sizeof(TO) == sizeof(FROM), "WTF::bitwise_cast sizeof casted t ypes should be equal"); 175 static_assert(sizeof(TO) == sizeof(FROM), "WTF::bitwiseCast sizeof casted ty pes should be equal");
176 union { 176 union {
177 FROM from; 177 FROM from;
178 TO to; 178 TO to;
179 } u; 179 } u;
180 u.from = from; 180 u.from = from;
181 return u.to; 181 return u.to;
182 } 182 }
183 183
184 template<typename To, typename From> 184 template<typename To, typename From>
185 inline To safeCast(From value) 185 inline To safeCast(From value)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } // namespace WTF 228 } // namespace WTF
229 229
230 // This version of placement new omits a 0 check. 230 // This version of placement new omits a 0 check.
231 enum NotNullTag { NotNull }; 231 enum NotNullTag { NotNull };
232 inline void* operator new(size_t, NotNullTag, void* location) 232 inline void* operator new(size_t, NotNullTag, void* location)
233 { 233 {
234 ASSERT(location); 234 ASSERT(location);
235 return location; 235 return location;
236 } 236 }
237 237
238 using WTF::bitwise_cast; 238 using WTF::bitwiseCast;
239 using WTF::safeCast; 239 using WTF::safeCast;
240 240
241 #endif // WTF_StdLibExtras_h 241 #endif // WTF_StdLibExtras_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashFunctions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698