Chromium Code Reviews| Index: src/utils.h |
| =================================================================== |
| --- src/utils.h (revision 535) |
| +++ src/utils.h (working copy) |
| @@ -443,6 +443,19 @@ |
| DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); |
| }; |
| + |
| +// Widening copy from ASCII to 16 bit chars. This is templatized to allow |
| +// it to be used inside if statements in templatized callers, but it is only |
| +// usable for sinkchar == uc16. |
| +template <typename sinkchar> |
| +static inline void Cpy168(sinkchar* dest, const unsigned char* src, int chars) { |
|
Christian Plesner Hansen
2008/10/21 14:16:22
You may consider copying the first parts of the st
Erik Corry
2008/10/22 11:59:48
Can't do this because of alignment issues.
|
| + ASSERT(sizeof(sinkchar) == 2); |
|
Christian Plesner Hansen
2008/10/21 14:16:22
You can use STATIC_CHECK here to catch this at com
|
| + while (chars--) { |
| + char c = *src++; |
| + *dest++ = c; |
| + } |
| +} |
| + |
| } } // namespace v8::internal |
| #endif // V8_UTILS_H_ |