pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:426:       if(Pike_sp[1-args].u.integer <= 0)    PIKE_ERROR("hash", "Modulo < 1.\n", Pike_sp, args);       i%=(unsigned INT32)Pike_sp[1-args].u.integer;    }    pop_n_elems(args);    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    *! native integer range.    *!    *! The hash will be the same for the same value in the running    *! process only (the memory address is typically used as the basis    *! for the hash value).    *!    *! If the value is an object with an @[lfun::__hash], that function
pike.git/src/builtin_functions.c:9375:    tFunc(tOr(tStr,tArr(tStr)) tSetvar(1,tArr(tStr)),tVar(1))),    OPT_TRY_OPTIMIZE);       /* function(string,int|void:int) */    ADD_EFUN("hash_7_8", f_hash_7_8,    tAttr("deprecated",tFunc(tStr tOr(tInt,tVoid),tInt)),OPT_TRY_OPTIMIZE);       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);       ADD_EFUN("hash_value",f_hash_value,tFunc(tMix,tInt),OPT_TRY_OPTIMIZE);       ADD_EFUN2("indices",f_indices,    tOr3(tFunc(tArray,tArr(tIntPos)),    tFunc(tOr3(tMap(tSetvar(1,tMix),tMix),    tSet(tSetvar(1,tMix)),    tNStr(tSetvar(1,tInt))),