pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
2016-06-24
2016-06-24 16:51:13 by Per Hedbor <ph@opera.com>
569189d7a7ce34fbe4e1a083df2c3c077f7606ca (
17
lines) (+
17
/-
0
)
[
Show
|
Annotate
]
Branch:
8.1
Added a new hash() function using siphash.
433:
push_int64(i); }
+
static void f_hash( INT32 args )
+
{
+
int len = 0;
+
if( TYPEOF(Pike_sp[-args]) != PIKE_T_STRING )
+
PIKE_ERROR("hash","Argument is not a string\n",Pike_sp,args);
+
if( args > 1 )
+
len = Pike_sp[-args+1].u.integer;
+
else
+
len = Pike_sp[-1].u.string->len;
+
push_int( hashmem_siphash24( Pike_sp[-1].u.string->str,
+
len << Pike_sp[-1].u.string->size_shift));
+
}
+
/*! @decl int hash_value (mixed value) *! *! Return a hash value for the argument. It's an integer in the
9382:
ADD_EFUN("hash_7_0",f_hash_7_0, tAttr("deprecated",tFunc(tStr tOr(tInt,tVoid),tInt)),OPT_TRY_OPTIMIZE);
+
ADD_EFUN("hash",f_hash,
+
tFunc(tStr tOr(tInt,tVoid),tInt), OPT_TRY_OPTIMIZE);
+
ADD_EFUN("hash_7_4",f_hash_7_4, tAttr("deprecated",tFunc(tStr tOr(tInt,tVoid),tInt)),OPT_TRY_OPTIMIZE);