| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 template <typename CharacterType> | 71 template <typename CharacterType> |
| 72 inline bool isAllASCII(MachineWord word) { | 72 inline bool isAllASCII(MachineWord word) { |
| 73 return !(word & NonASCIIMask<sizeof(MachineWord), CharacterType>::value()); | 73 return !(word & NonASCIIMask<sizeof(MachineWord), CharacterType>::value()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Note: This function assume the input is likely all ASCII, and | 76 // Note: This function assume the input is likely all ASCII, and |
| 77 // does not leave early if it is not the case. | 77 // does not leave early if it is not the case. |
| 78 template <typename CharacterType> | 78 template <typename CharacterType> |
| 79 inline bool charactersAreAllASCII(const CharacterType* characters, | 79 inline bool charactersAreAllASCII(const CharacterType* characters, |
| 80 size_t length) { | 80 size_t length) { |
| 81 DCHECK_GT(length, 0u); |
| 81 MachineWord allCharBits = 0; | 82 MachineWord allCharBits = 0; |
| 82 const CharacterType* end = characters + length; | 83 const CharacterType* end = characters + length; |
| 83 | 84 |
| 84 // Prologue: align the input. | 85 // Prologue: align the input. |
| 85 while (!isAlignedToMachineWord(characters) && characters != end) { | 86 while (!isAlignedToMachineWord(characters) && characters != end) { |
| 86 allCharBits |= *characters; | 87 allCharBits |= *characters; |
| 87 ++characters; | 88 ++characters; |
| 88 } | 89 } |
| 89 | 90 |
| 90 // Compare the values of CPU word size. | 91 // Compare the values of CPU word size. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 for (size_t i = 0; i < length; ++i) { | 174 for (size_t i = 0; i < length; ++i) { |
| 174 DCHECK(!(source[i] & 0xff00)); | 175 DCHECK(!(source[i] & 0xff00)); |
| 175 destination[i] = static_cast<LChar>(source[i]); | 176 destination[i] = static_cast<LChar>(source[i]); |
| 176 } | 177 } |
| 177 #endif | 178 #endif |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace WTF | 181 } // namespace WTF |
| 181 | 182 |
| 182 #endif // ASCIIFastPath_h | 183 #endif // ASCIIFastPath_h |
| OLD | NEW |