[PATCH 1/2] string: add find_ne_all to string-fza.h
Wilco Dijkstra <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <DB3PR08MB89862FCBB9A6105E837684DC83DB2@DB3PR08MB8986.eurprd08.prod.outlook.com> |
Hi Matt,
+static __always_inline find_t
+find_ne_all (op_t x1, op_t x2)
+{
+ op_t m = repeat_bytes (0x7f);
+ op_t ne = x1 ^ x2;
+ return (((ne & m) + m) | ne) & ~m;
+}
That's a lot of code to do very little... In fact we don't need it if
HAVE_BITOPTS_WORKING is set since clz/ctz work fine on (x1 ^ x2).
The related find_zero_ne_all() has the same issue - we can just do
(x1 ^ x2) | find_zero_all (x1) if HAVE_BITOPTS_WORKING.
And we could remove the unnecessary code from string-fzi.h if all targets
now have working stdc_leading_zeros/stdc_trailing_zeros.
Cheers,
Wilco