+#define HFTA_VSTR_LHASHFUNC_PRIME 12916008961267169387ull
+gs_uint64_t hfta_vstr_long_hashfunc(const vstring *s) {
+ gs_uint64_t hash_code;
+ gs_int32_t n_steps;
+ gs_int32_t substr_len;
+ gs_int32_t j, k;
+ gs_uint64_t sub_hash;
+ gs_sp_t sv;
+
+ sv=(gs_sp_t)(s->offset);
+ hash_code = 0;
+ n_steps = s->length / 4;
+ if(4*n_steps < s->length) n_steps++;
+
+ for (j = 0; j < n_steps; j++) {
+ if(4*(j+1) < s->length) substr_len = 4;
+ else substr_len = s->length - 4*j;
+
+ sub_hash = 0;
+ for(k=0;k<4;k++){
+ if(k < substr_len)
+ sub_hash = (sub_hash << 4) + *sv;
+ else
+ sub_hash = (sub_hash << 4);
+ sv++;
+ }
+
+ hash_code = (sub_hash + hash_code * HFTA_VSTR_LHASHFUNC_PRIME);
+ }
+
+ return(hash_code);
+}
+