| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_CASTS_H_ | 5 #ifndef BASE_CASTS_H_ |
| 6 #define BASE_CASTS_H_ | 6 #define BASE_CASTS_H_ |
| 7 | 7 |
| 8 #include <assert.h> // for use with down_cast<> | 8 #include <assert.h> // for use with down_cast<> |
| 9 #include <string.h> // for memcpy | 9 #include <string.h> // for memcpy |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Compile time assertion: sizeof(Dest) == sizeof(Source) | 147 // Compile time assertion: sizeof(Dest) == sizeof(Source) |
| 148 // A compile error here means your Dest and Source have different sizes. | 148 // A compile error here means your Dest and Source have different sizes. |
| 149 typedef char VerifySizesAreEqual [sizeof(Dest) == sizeof(Source) ? 1 : -1]; | 149 typedef char VerifySizesAreEqual [sizeof(Dest) == sizeof(Source) ? 1 : -1]; |
| 150 | 150 |
| 151 Dest dest; | 151 Dest dest; |
| 152 memcpy(&dest, &source, sizeof(dest)); | 152 memcpy(&dest, &source, sizeof(dest)); |
| 153 return dest; | 153 return dest; |
| 154 } | 154 } |
| 155 | 155 |
| 156 #endif // BASE_CASTS_H_ | 156 #endif // BASE_CASTS_H_ |
| OLD | NEW |