mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
js: initial work on porting rand module to JS backend (#11188)
This commit is contained in:
@@ -21,3 +21,13 @@ pub fn wyhash_c(key &byte, len u64, seed u64) u64 {
|
||||
pub fn wyhash64_c(a u64, b u64) u64 {
|
||||
return C.wyhash64(a, b)
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn sum64_string(key string, seed u64) u64 {
|
||||
return wyhash_c(key.str, u64(key.len), seed)
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn sum64(key []byte, seed u64) u64 {
|
||||
return wyhash_c(&byte(key.data), u64(key.len), seed)
|
||||
}
|
||||
|
1
vlib/hash/wyhash.js.v
Normal file
1
vlib/hash/wyhash.js.v
Normal file
@@ -0,0 +1 @@
|
||||
module hash
|
@@ -23,16 +23,6 @@ const (
|
||||
wyp4 = u64(0x1d8e4e27c47d124f)
|
||||
)
|
||||
|
||||
[inline]
|
||||
pub fn sum64_string(key string, seed u64) u64 {
|
||||
return wyhash_c(key.str, u64(key.len), seed)
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn sum64(key []byte, seed u64) u64 {
|
||||
return wyhash_c(&byte(key.data), u64(key.len), seed)
|
||||
}
|
||||
|
||||
[inline]
|
||||
fn wyrotr(v u64, k u32) u64 {
|
||||
return (v >> k) | (v << (64 - k))
|
||||
|
Reference in New Issue
Block a user