1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: add map string generation

This commit is contained in:
Kris Cherven
2020-04-21 22:00:38 -04:00
committed by GitHub
parent 5c3742fbd2
commit b288ecb795
3 changed files with 94 additions and 3 deletions

View File

@ -135,6 +135,16 @@ fn (d mut DenseArray) push(kv KeyValue) u32 {
return push_index
}
// Private function. Used to implement array[] operator
fn (d DenseArray) get(i int) voidptr {
$if !no_bounds_checking? {
if i < 0 || i >= d.size {
panic('DenseArray.get: index out of range (i == $i, d.len == $d.size)')
}
}
return byteptr(d.data) + i * sizeof(KeyValue)
}
// Move all zeros to the end of the array
// and resize array
fn (d mut DenseArray) zeros_to_end() {