Added string-hash.
This commit is contained in:
parent
0de54fc0c6
commit
c25e04569c
|
@ -18,7 +18,8 @@
|
|||
(export make-eq-hashtable hashtable-ref hashtable-set! hashtable?
|
||||
hashtable-size hashtable-delete! hashtable-contains?
|
||||
hashtable-update! hashtable-keys hashtable-mutable?
|
||||
hashtable-clear! hashtable-entries hashtable-copy)
|
||||
hashtable-clear! hashtable-entries hashtable-copy
|
||||
string-hash)
|
||||
(import
|
||||
(ikarus system $pairs)
|
||||
(ikarus system $vectors)
|
||||
|
@ -27,7 +28,8 @@
|
|||
(except (ikarus) make-eq-hashtable hashtable-ref hashtable-set! hashtable?
|
||||
hashtable-size hashtable-delete! hashtable-contains?
|
||||
hashtable-update! hashtable-keys hashtable-mutable?
|
||||
hashtable-clear! hashtable-entries hashtable-copy))
|
||||
hashtable-clear! hashtable-entries hashtable-copy
|
||||
string-hash))
|
||||
|
||||
(define-struct hasht (vec count tc mutable?))
|
||||
|
||||
|
@ -404,4 +406,9 @@
|
|||
h)
|
||||
(error 'hashtable-copy "not a hash table" h))]))
|
||||
|
||||
(define (string-hash s)
|
||||
(if (string? s)
|
||||
(foreign-call "ikrt_string_hash" s)
|
||||
(error 'string-hash "not a string" s)))
|
||||
|
||||
)
|
||||
|
|
|
@ -1 +1 @@
|
|||
1114
|
||||
1115
|
||||
|
|
|
@ -1192,7 +1192,7 @@
|
|||
[make-hashtable r ht]
|
||||
[hashtable-equivalence-function r ht]
|
||||
[equal-hash r ht]
|
||||
[string-hash r ht]
|
||||
[string-hash i r ht]
|
||||
[string-ci-hash r ht]
|
||||
[symbol-hash r ht]
|
||||
[list-sort i r sr]
|
||||
|
|
|
@ -565,7 +565,7 @@
|
|||
[flush-output-port C ip]
|
||||
[get-bytevector-all S ip]
|
||||
[get-bytevector-n C ip]
|
||||
[get-bytevector-n! S ip]
|
||||
[get-bytevector-n! C ip]
|
||||
[get-bytevector-some S ip]
|
||||
[get-char C ip]
|
||||
[get-datum C ip]
|
||||
|
@ -699,7 +699,7 @@
|
|||
[make-hashtable S ht]
|
||||
[hashtable-equivalence-function S ht]
|
||||
[equal-hash S ht]
|
||||
[string-hash S ht]
|
||||
[string-hash C ht]
|
||||
[string-ci-hash S ht]
|
||||
[symbol-hash S ht]
|
||||
;;;
|
||||
|
|
|
@ -51,6 +51,11 @@ compute_hash(ikp str){
|
|||
return h;
|
||||
}
|
||||
|
||||
ikp
|
||||
ikrt_string_hash(ikp str){
|
||||
return fix(compute_hash(str));
|
||||
}
|
||||
|
||||
static int strings_eqp(ikp str1, ikp str2){
|
||||
ikp len = ref(str1, off_string_length);
|
||||
if(len == ref(str2, off_string_length)){
|
||||
|
|
Loading…
Reference in New Issue