| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef TextCodecASCIIFastPath_h | 27 #ifndef TextCodecASCIIFastPath_h |
| 28 #define TextCodecASCIIFastPath_h | 28 #define TextCodecASCIIFastPath_h |
| 29 | 29 |
| 30 #include "wtf/text/ASCIIFastPath.h" | 30 #include "wtf/text/ASCIIFastPath.h" |
| 31 | 31 |
| 32 namespace WTF { | 32 namespace WTF { |
| 33 | 33 |
| 34 template<size_t size> struct UCharByteFiller; | 34 template <size_t size> |
| 35 template<> struct UCharByteFiller<4> { | 35 struct UCharByteFiller; |
| 36 static void copy(LChar* destination, const uint8_t* source) | 36 template <> |
| 37 { | 37 struct UCharByteFiller<4> { |
| 38 memcpy(destination, source, 4); | 38 static void copy(LChar* destination, const uint8_t* source) { |
| 39 } | 39 memcpy(destination, source, 4); |
| 40 } |
| 40 | 41 |
| 41 static void copy(UChar* destination, const uint8_t* source) | 42 static void copy(UChar* destination, const uint8_t* source) { |
| 42 { | 43 destination[0] = source[0]; |
| 43 destination[0] = source[0]; | 44 destination[1] = source[1]; |
| 44 destination[1] = source[1]; | 45 destination[2] = source[2]; |
| 45 destination[2] = source[2]; | 46 destination[3] = source[3]; |
| 46 destination[3] = source[3]; | 47 } |
| 47 } | |
| 48 }; | 48 }; |
| 49 template<> struct UCharByteFiller<8> { | 49 template <> |
| 50 static void copy(LChar* destination, const uint8_t* source) | 50 struct UCharByteFiller<8> { |
| 51 { | 51 static void copy(LChar* destination, const uint8_t* source) { |
| 52 memcpy(destination, source, 8); | 52 memcpy(destination, source, 8); |
| 53 } | 53 } |
| 54 | 54 |
| 55 static void copy(UChar* destination, const uint8_t* source) | 55 static void copy(UChar* destination, const uint8_t* source) { |
| 56 { | 56 destination[0] = source[0]; |
| 57 destination[0] = source[0]; | 57 destination[1] = source[1]; |
| 58 destination[1] = source[1]; | 58 destination[2] = source[2]; |
| 59 destination[2] = source[2]; | 59 destination[3] = source[3]; |
| 60 destination[3] = source[3]; | 60 destination[4] = source[4]; |
| 61 destination[4] = source[4]; | 61 destination[5] = source[5]; |
| 62 destination[5] = source[5]; | 62 destination[6] = source[6]; |
| 63 destination[6] = source[6]; | 63 destination[7] = source[7]; |
| 64 destination[7] = source[7]; | 64 } |
| 65 } | |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 inline void copyASCIIMachineWord(LChar* destination, const uint8_t* source) | 67 inline void copyASCIIMachineWord(LChar* destination, const uint8_t* source) { |
| 69 { | 68 UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); |
| 70 UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); | |
| 71 } | 69 } |
| 72 | 70 |
| 73 inline void copyASCIIMachineWord(UChar* destination, const uint8_t* source) | 71 inline void copyASCIIMachineWord(UChar* destination, const uint8_t* source) { |
| 74 { | 72 UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); |
| 75 UCharByteFiller<sizeof(WTF::MachineWord)>::copy(destination, source); | |
| 76 } | 73 } |
| 77 | 74 |
| 78 } // namespace WTF | 75 } // namespace WTF |
| 79 | 76 |
| 80 #endif // TextCodecASCIIFastPath_h | 77 #endif // TextCodecASCIIFastPath_h |
| OLD | NEW |