Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2010 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef GrTemplates_DEFINED | |
| 9 #define GrTemplates_DEFINED | |
| 10 | |
| 11 #include "SkTypes.h" | |
| 12 | |
| 13 /** | |
| 14 * Use to cast a ptr to a different type, and maintain strict-aliasing | |
| 15 */ | |
| 16 template <typename Dst, typename Src> Dst GrTCast(Src src) { | |
| 17 union { | |
| 18 Src src; | |
| 19 Dst dst; | |
| 20 } data; | |
| 21 data.src = src; | |
| 22 return data.dst; | |
| 23 } | |
| 24 | |
| 25 #endif | |
| OLD | NEW |