mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: prepare modules hash
and term
for -Wimpure-v
This commit is contained in:
parent
ed50e22e18
commit
3064fff95b
11
vlib/hash/wyhash.c.v
Normal file
11
vlib/hash/wyhash.c.v
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module hash
|
||||||
|
|
||||||
|
//#flag -I @VROOT/thirdparty/wyhash
|
||||||
|
//#include "wyhash.h"
|
||||||
|
fn C.wyhash(byteptr, u64, u64) u64
|
||||||
|
|
||||||
|
[inline]
|
||||||
|
pub fn wyhash_c(key byteptr, len u64, seed u64) u64 {
|
||||||
|
return C.wyhash(key, len, seed)
|
||||||
|
}
|
||||||
|
|
@ -15,11 +15,6 @@
|
|||||||
// try running with and without the `-prod` flag
|
// try running with and without the `-prod` flag
|
||||||
module hash
|
module hash
|
||||||
|
|
||||||
//#flag -I @VROOT/thirdparty/wyhash
|
|
||||||
//#include "wyhash.h"
|
|
||||||
fn C.wyhash(byteptr, u64, u64) u64
|
|
||||||
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
wyp0 = u64(0xa0761d6478bd642f)
|
wyp0 = u64(0xa0761d6478bd642f)
|
||||||
wyp1 = u64(0xe7037ed1a0b428db)
|
wyp1 = u64(0xe7037ed1a0b428db)
|
||||||
@ -28,11 +23,6 @@ const (
|
|||||||
wyp4 = u64(0x1d8e4e27c47d124f)
|
wyp4 = u64(0x1d8e4e27c47d124f)
|
||||||
)
|
)
|
||||||
|
|
||||||
[inline]
|
|
||||||
pub fn wyhash_c(key byteptr, len u64, seed u64) u64 {
|
|
||||||
return C.wyhash(key, len, seed)
|
|
||||||
}
|
|
||||||
|
|
||||||
[inline]
|
[inline]
|
||||||
pub fn sum64_string(key string, seed u64) u64 {
|
pub fn sum64_string(key string, seed u64) u64 {
|
||||||
return wyhash64(key.str, u64(key.len), seed)
|
return wyhash64(key.str, u64(key.len), seed)
|
||||||
|
@ -117,7 +117,7 @@ fn supports_escape_sequences(fd int) bool {
|
|||||||
// clear clears current terminal screen.
|
// clear clears current terminal screen.
|
||||||
pub fn clear() {
|
pub fn clear() {
|
||||||
$if !windows {
|
$if !windows {
|
||||||
C.printf('\x1b[2J')
|
print('\x1b[2J')
|
||||||
C.printf('\x1b[H')
|
print('\x1b[H')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user