Added string-ci-hash and symbol-hash.
Slight change to ikrt_string_hash.
This commit is contained in:
parent
c25e04569c
commit
42daf68195
|
@ -19,7 +19,7 @@
|
|||
hashtable-size hashtable-delete! hashtable-contains?
|
||||
hashtable-update! hashtable-keys hashtable-mutable?
|
||||
hashtable-clear! hashtable-entries hashtable-copy
|
||||
string-hash)
|
||||
string-hash string-ci-hash symbol-hash)
|
||||
(import
|
||||
(ikarus system $pairs)
|
||||
(ikarus system $vectors)
|
||||
|
@ -29,7 +29,7 @@
|
|||
hashtable-size hashtable-delete! hashtable-contains?
|
||||
hashtable-update! hashtable-keys hashtable-mutable?
|
||||
hashtable-clear! hashtable-entries hashtable-copy
|
||||
string-hash))
|
||||
string-hash string-ci-hash symbol-hash))
|
||||
|
||||
(define-struct hasht (vec count tc mutable?))
|
||||
|
||||
|
@ -411,4 +411,15 @@
|
|||
(foreign-call "ikrt_string_hash" s)
|
||||
(error 'string-hash "not a string" s)))
|
||||
|
||||
(define (string-ci-hash s)
|
||||
(if (string? s)
|
||||
(foreign-call "ikrt_string_hash"
|
||||
(string-foldcase s))
|
||||
(error 'string-ci-hash "not a string" s)))
|
||||
|
||||
(define (symbol-hash s)
|
||||
(if (symbol? s)
|
||||
(foreign-call "ikrt_string_hash" (symbol->string s))
|
||||
(error 'symbol-hash "not a symbol" s)))
|
||||
|
||||
)
|
||||
|
|
|
@ -1 +1 @@
|
|||
1115
|
||||
1116
|
||||
|
|
|
@ -1193,8 +1193,8 @@
|
|||
[hashtable-equivalence-function r ht]
|
||||
[equal-hash r ht]
|
||||
[string-hash i r ht]
|
||||
[string-ci-hash r ht]
|
||||
[symbol-hash r ht]
|
||||
[string-ci-hash i r ht]
|
||||
[symbol-hash i r ht]
|
||||
[list-sort i r sr]
|
||||
[vector-sort i r sr]
|
||||
[vector-sort! i r sr]
|
||||
|
|
|
@ -700,8 +700,8 @@
|
|||
[hashtable-equivalence-function S ht]
|
||||
[equal-hash S ht]
|
||||
[string-hash C ht]
|
||||
[string-ci-hash S ht]
|
||||
[symbol-hash S ht]
|
||||
[string-ci-hash C ht]
|
||||
[symbol-hash C ht]
|
||||
;;;
|
||||
[list-sort C sr]
|
||||
[vector-sort C sr]
|
||||
|
|
|
@ -53,7 +53,7 @@ compute_hash(ikp str){
|
|||
|
||||
ikp
|
||||
ikrt_string_hash(ikp str){
|
||||
return fix(compute_hash(str));
|
||||
return compute_hash(str) & (~ fx_mask);
|
||||
}
|
||||
|
||||
static int strings_eqp(ikp str1, ikp str2){
|
||||
|
|
Loading…
Reference in New Issue