/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file should only be compiled if you're on Power ISA.
// Check one VMX register (8 unichars) at a time. The vec_any_gt // intrinsic does exactly what we want. This loop is manually unrolled; // it yields notable performance improvements this way. #define CheckForASCII \
vect = vec_ld(i2, reinterpret_cast<constunsignedshort*>(str)); \ if (vec_any_gt(vect, gtcompare)) return i; \
i += numUnicharsPerVector; \ if (!(i < vectWalkEnd)) break; \
i2 += numCharsPerVector;
CheckForASCII CheckForASCII
#undef CheckForASCII
}
} else { // Align ourselves to a word boundary.
alignLen = std::min(len, uint32_t(((-NS_PTR_TO_UINT32(str)) & alignMask) / sizeof(char16_t))); for (; i < alignLen; i++) { if (str[i] > 255) return i;
}
}
// Check one word at a time. const uint32_t wordWalkEnd =
((len - i) / numUnicharsPerWord) * numUnicharsPerWord; for (; i < wordWalkEnd; i += numUnicharsPerWord) { const size_t word = *reinterpret_cast<const size_t*>(str + i); if (word & mask) return i;
}
// Take care of the remainder one character at a time. for (; i < len; i++) { if (str[i] > 255) { return i;
}
}
return -1;
}
} // namespace VMX
} // namespace mozilla
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.