Skip to content

Commit a648608

Browse files
committed
Switch hash() function to use fastzpp
For short inputs ZPP can be a large fraction of the hash() execution time.
1 parent 7c787e5 commit a648608

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ext/hash/hash.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
123123
void *context;
124124
php_stream *stream = NULL;
125125

126-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &algo, &data, &data_len, &raw_output) == FAILURE) {
127-
RETURN_THROWS();
128-
}
126+
ZEND_PARSE_PARAMETERS_START(2, 3)
127+
Z_PARAM_STR(algo)
128+
Z_PARAM_STRING(data, data_len)
129+
Z_PARAM_OPTIONAL
130+
Z_PARAM_BOOL(raw_output)
131+
ZEND_PARSE_PARAMETERS_END();
129132

130133
ops = php_hash_fetch_ops(algo);
131134
if (!ops) {

0 commit comments

Comments
 (0)