Open Bug 1532356 Opened 6 years ago Updated 2 years ago

There doesn't seem to be a way to compare a uint16_t string to a latin1 string

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

Tracking Status
firefox67 --- affected

People

(Reporter: bzbarsky, Unassigned)

References

Details

In bug 1530208 I am trying to compare two textfragments' text. Textfragment stores its data as either a uint16_t* or a char*, and in the latter case it's latin1-encoded (so we use it for cases when all the uint16_t's in our string were <255).

There doesn't seem to be a way to compare those two cases to each other without rolling my own compare. The actual code would pretty much look like EqualsASCII, but we'd need to be a little careful about signed vs unsigned bits and whatnot.

We do have a nice preexisting, and even vectorized, LossyConvertUTF16toLatin1...

It would make sense to put a vectorized comparison in encoding_rs::mem. Considering the infra change from simd to packed_simd, as a practical matter, landing such a vectorization in m-c needs to wait for bug 1521249.

Depends on: 1521249
Component: String → XPCOM
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.