diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-06-13 11:24:38 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-06-13 11:24:38 +0300 |
commit | 289733ed456f7c1cbdb1f1ca58312f77c239953b (patch) | |
tree | 99bed0a5c21d0bdc5f6c10bc80a1ae8dbbd56be6 /arch/tile/lib/strchr_64.c | |
parent | c3a21fc79b6bc097d8b0e47498903a649a111127 (diff) | |
parent | cfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff) | |
download | kernel_goldelico_gta04-289733ed456f7c1cbdb1f1ca58312f77c239953b.zip kernel_goldelico_gta04-289733ed456f7c1cbdb1f1ca58312f77c239953b.tar.gz kernel_goldelico_gta04-289733ed456f7c1cbdb1f1ca58312f77c239953b.tar.bz2 |
Merge tag 'v3.5-rc2'
Merge v3.5-rc2 to get latest device tree and dynamic debug changes.
Diffstat (limited to 'arch/tile/lib/strchr_64.c')
-rw-r--r-- | arch/tile/lib/strchr_64.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/tile/lib/strchr_64.c b/arch/tile/lib/strchr_64.c index 617a927..f39f9dc 100644 --- a/arch/tile/lib/strchr_64.c +++ b/arch/tile/lib/strchr_64.c @@ -15,8 +15,7 @@ #include <linux/types.h> #include <linux/string.h> #include <linux/module.h> - -#undef strchr +#include "string-endian.h" char *strchr(const char *s, int c) { @@ -33,13 +32,9 @@ char *strchr(const char *s, int c) * match neither zero nor goal (we make sure the high bit of each * byte is 1, and the low 7 bits are all the opposite of the goal * byte). - * - * Note that this shift count expression works because we know shift - * counts are taken mod 64. */ - const uint64_t before_mask = (1ULL << (s_int << 3)) - 1; - uint64_t v = (*p | before_mask) ^ - (goal & __insn_v1shrsi(before_mask, 1)); + const uint64_t before_mask = MASK(s_int); + uint64_t v = (*p | before_mask) ^ (goal & __insn_v1shrui(before_mask, 1)); uint64_t zero_matches, goal_matches; while (1) { @@ -55,8 +50,8 @@ char *strchr(const char *s, int c) v = *++p; } - z = __insn_ctz(zero_matches); - g = __insn_ctz(goal_matches); + z = CFZ(zero_matches); + g = CFZ(goal_matches); /* If we found c before '\0' we got a match. Note that if c == '\0' * then g == z, and we correctly return the address of the '\0' |