diff --git a/storage/cpu.v b/storage/cpu.v index 7bd97ed9..2e3d8631 100644 --- a/storage/cpu.v +++ b/storage/cpu.v @@ -29,57 +29,57 @@ pub fn from_array[T](arr []T) &CpuStorage[T] { // Private function. Used to implement Storage operator [inline] -pub fn (storage &CpuStorage[T]) get[T](i int) T { - return storage.data[i] +pub fn (s &CpuStorage[T]) get[T](i int) T { + return s.data[i] } // Private function. Used to implement assigment to the Storage element [inline] -pub fn (mut storage CpuStorage[T]) set[T](i int, val T) { - storage.data[i] = val +pub fn (mut s CpuStorage[T]) set[T](i int, val T) { + s.data[i] = val } // fill fills an entire storage with a given value -pub fn (mut storage CpuStorage[T]) fill[T](val T) { - for i in 0 .. storage.data.len { - storage.data[i] = val +pub fn (mut s CpuStorage[T]) fill[T](val T) { + for i in 0 .. s.data.len { + s.data[i] = val } } // clone returns an independent copy of a given Storage [inline] -pub fn (storage &CpuStorage[T]) clone[T]() &CpuStorage[T] { +pub fn (s &CpuStorage[T]) clone[T]() &CpuStorage[T] { return &CpuStorage[T]{ - data: storage.data.clone() + data: s.data.clone() } } // like returns an independent copy of a given Storage [inline] -pub fn (storage &CpuStorage[T]) like[T]() &CpuStorage[T] { +pub fn (s &CpuStorage[T]) like[T]() &CpuStorage[T] { return &CpuStorage[T]{ - data: []T{len: storage.data.len, cap: storage.data.cap} + data: []T{len: s.data.len, cap: s.data.cap} } } // like_with_len returns an independent copy of a given Storage [inline] -pub fn (storage &CpuStorage[T]) like_with_len[T](len int) &CpuStorage[T] { - mut capacity := if storage.data.cap < len { len } else { storage.data.cap } +pub fn (s &CpuStorage[T]) like_with_len[T](len int) &CpuStorage[T] { + mut capacity := if s.data.cap < len { len } else { s.data.cap } return &CpuStorage[T]{ data: []T{len: len, cap: capacity} } } -pub fn (storage &CpuStorage[T]) offset[T](start int) &CpuStorage[T] { +pub fn (s &CpuStorage[T]) offset[T](start int) &CpuStorage[T] { return &CpuStorage[T]{ - data: storage.data[start..storage.data.len] + data: s.data[start..s.data.len] } } [inline] -pub fn (storage &CpuStorage[T]) to_array[T]() []T { - return storage.data.clone() +pub fn (s &CpuStorage[T]) to_array[T]() []T { + return s.data.clone() } [inline]