From 159ee005635a5d2da057758372fa77be04a795a4 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 10 May 2021 09:22:50 +0300 Subject: [PATCH] builtin: remove `import hash` --- vlib/builtin/map.v | 15 ++++++++------- vlib/v/util/util.v | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/vlib/builtin/map.v b/vlib/builtin/map.v index d9b33498e1..91e473e9e7 100644 --- a/vlib/builtin/map.v +++ b/vlib/builtin/map.v @@ -3,8 +3,9 @@ // that can be found in the LICENSE file. module builtin -// import hash.wyhash as hash -import hash +fn C.wyhash(&byte, u64, u64, &u64) u64 + +fn C.wyhash64(u64, u64) u64 /* This is a highly optimized hashmap implementation. It has several traits that @@ -247,23 +248,23 @@ pub mut: fn map_hash_string(pkey voidptr) u64 { key := *unsafe { &string(pkey) } - return hash.wyhash_c(key.str, u64(key.len), 0) + return C.wyhash(key.str, u64(key.len), 0, &u64(C._wyp)) } fn map_hash_int_1(pkey voidptr) u64 { - return hash.wyhash64_c(*unsafe { &byte(pkey) }, 0) + return C.wyhash64(*unsafe { &byte(pkey) }, 0) } fn map_hash_int_2(pkey voidptr) u64 { - return hash.wyhash64_c(*unsafe { &u16(pkey) }, 0) + return C.wyhash64(*unsafe { &u16(pkey) }, 0) } fn map_hash_int_4(pkey voidptr) u64 { - return hash.wyhash64_c(*unsafe { &u32(pkey) }, 0) + return C.wyhash64(*unsafe { &u32(pkey) }, 0) } fn map_hash_int_8(pkey voidptr) u64 { - return hash.wyhash64_c(*unsafe { &u64(pkey) }, 0) + return C.wyhash64(*unsafe { &u64(pkey) }, 0) } fn map_eq_string(a voidptr, b voidptr) bool { diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 2034784a20..f8668998fd 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -15,7 +15,7 @@ pub const ( // math.bits is needed by strconv.ftoa pub const ( - builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'hash', 'strings', 'builtin'] + builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'strings', 'builtin'] bundle_modules = ['clipboard', 'fontstash', 'gg', 'gx', 'sokol', 'szip', 'ui'] )