forked from M-Labs/nalgebra
Fix inner size
This commit is contained in:
parent
d5ca2019a3
commit
b25c2aa78c
@ -125,17 +125,19 @@ macro_rules! iterator {
|
|||||||
// element we want to return.
|
// element we want to return.
|
||||||
self.size -= 1;
|
self.size -= 1;
|
||||||
|
|
||||||
|
// Fetch strides
|
||||||
|
let inner_stride = self.strides.0.value();
|
||||||
|
let outer_stride = self.strides.1.value();
|
||||||
|
|
||||||
// Compute number of rows
|
// Compute number of rows
|
||||||
let inner_size = self.inner_end.offset_from(self.inner_ptr) as usize;
|
// Division should be exact
|
||||||
|
let inner_raw_size = self.inner_end.offset_from(self.inner_ptr) as usize;
|
||||||
|
let inner_size = inner_raw_size / inner_stride;
|
||||||
|
|
||||||
// Compute rows and cols remaining
|
// Compute rows and cols remaining
|
||||||
let outer_remaining = self.size / inner_size;
|
let outer_remaining = self.size / inner_size;
|
||||||
let inner_remaining = self.size % inner_size;
|
let inner_remaining = self.size % inner_size;
|
||||||
|
|
||||||
// Fetch strides
|
|
||||||
let inner_stride = self.strides.0.value();
|
|
||||||
let outer_stride = self.strides.1.value();
|
|
||||||
|
|
||||||
// Compute pointer to last element
|
// Compute pointer to last element
|
||||||
let last = self.ptr.offset(
|
let last = self.ptr.offset(
|
||||||
(outer_remaining * outer_stride + inner_remaining * inner_stride)
|
(outer_remaining * outer_stride + inner_remaining * inner_stride)
|
||||||
|
Loading…
Reference in New Issue
Block a user