Use __builtin_clz or std::countl_one in InflateUTF8ToUTF16
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox125 | --- | fixed |
People
(Reporter: arai, Assigned: sfink)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
https://phabricator.services.mozilla.com/D201330#inline-1116243
// Non-ASCII code unit. Determine its length in bytes (n).
uint32_t n = 1;
while (v & (0x80 >> n)) {
n++;
}
The code counts the number of leading 1
bits, as part of decoding UTF-8 code units.
Either of the following can be used:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fclz
https://en.cppreference.com/w/cpp/numeric/countl_one
Reporter | ||
Updated•1 year ago
|
Comment 1•1 year ago
|
||
There is also this: https://github.com/simdutf/simdutf
Comment 2•1 year ago
•
|
||
There's an MFBT function for this: CountLeadingZeroes32
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 3•1 year ago
|
||
Updated•1 year ago
|
Comment 5•1 year ago
|
||
Backed out for SM assertion failures on MathAlgorithms.
Push with failures: https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=retry%2Ctestfailed%2Cbusted%2Cexception%2Cusercancel&revision=695de01232f0b2d0f75cd8f82b2588a1c638a9ac
Failure log: https://treeherder.mozilla.org/logviewer?job_id=447783641&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/53f7baad39fc2408bc5c1ab6df97372a395730a4
Comment 8•1 year ago
|
||
bugherder |
Description
•