Implement f_strpbrk using libc's strcspn when there's no null bytes
commitd87ff2ba1e67ebafd3b0a6f4d717e94eaeaddcf2
authorJordan DeLong <jdelong@fb.com>
Sun, 13 Apr 2014 22:07:18 +0000 (13 15:07 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 18 Apr 2014 07:13:59 +0000 (18 00:13 -0700)
treee0a3923323760159c1da1d7d7047f1ab535cab4f
parentb7ff6a91c1a9c3510760d2842b19c74d44e83dbc
Implement f_strpbrk using libc's strcspn when there's no null bytes

Seems to get pack the instructions regression from the change
to a manual loop.  It looks like the libc implementation of strcspn is
similar to the implementation of strpbrk (various machine feature
detection with different implementations).  I think it is also
possible to use strcspn even if the set has null bytes in it if you
remove the null byte and record whether it should count as a hit
(since strcspn will always stop on a null byte), but this doesn't do
that.

Reviewed By: @billf

Differential Revision: D1276594
hphp/runtime/ext/ext_string.cpp
hphp/test/slow/ext_string/strpbrk_short_and_long.php [new file with mode: 0644]
hphp/test/slow/ext_string/strpbrk_short_and_long.php.expect [new file with mode: 0644]