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

bf: minor clean up

This commit is contained in:
Alexander Medvednikov
2019-09-08 18:53:40 +03:00
parent f70d206881
commit a6ec6e23bc
2 changed files with 13 additions and 8 deletions

View File

@@ -476,10 +476,9 @@ pub fn (instance mut BitField) reverse() BitField {
return output
}
// resize() changes the size of the bit array to 'new_size'
pub fn (instance mut BitField) resize(size int) {
new_bitnslots := bitnslots(size)
// resize changes the size of the bit array to 'new_size'
pub fn (instance mut BitField) resize(new_size int) {
new_bitnslots := bitnslots(new_size)
old_size := instance.size
old_bitnslots := bitnslots(old_size)
mut field := [u32(0); new_bitnslots]
@@ -487,7 +486,7 @@ pub fn (instance mut BitField) resize(size int) {
field[i] = instance.field[i]
}
instance.field = field.clone()
instance.size = size
instance.size = new_size
if size < old_size && size % SLOT_SIZE != 0 {
cleartail(mut instance)
}