Skip to content

Commit

Permalink
Fix voidptr arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel committed Dec 5, 2020
1 parent fe61d66 commit 45ce204
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vlib/builtin/map.v
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ fn (mut m map) get_and_set(key string, zero voidptr) voidptr {
kv_index := int(unsafe {m.metas[index + 1]})
pkey := unsafe {&string(m.key_values.key(kv_index))}
if fast_string_eq(key, *pkey) {
return unsafe {voidptr(pkey) + m.key_values.key_bytes}
return unsafe {byteptr(pkey) + m.key_values.key_bytes}
}
}
index += 2
Expand All @@ -425,7 +425,7 @@ fn (m map) get(key string, zero voidptr) voidptr {
kv_index := int(unsafe {m.metas[index + 1]})
pkey := unsafe {&string(m.key_values.key(kv_index))}
if fast_string_eq(key, *pkey) {
return unsafe {voidptr(pkey) + m.key_values.key_bytes}
return unsafe {byteptr(pkey) + m.key_values.key_bytes}
}
}
index += 2
Expand Down

0 comments on commit 45ce204

Please sign in to comment.