Skip to content

Commit 60a60b0

Browse files
committed
Revert #1563 to prepare for a patch release.
This reverts commit d573745. The commit will now live on the `refactor` branch until more of the new layout code is ready
1 parent 986c28d commit 60a60b0

File tree

12 files changed

+82
-88
lines changed

12 files changed

+82
-88
lines changed

src/indexes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::dimension::IntoDimension;
1010
use crate::split_at::SplitAt;
1111
use crate::zip::Offset;
1212
use crate::Axis;
13-
use crate::LayoutBitset;
13+
use crate::Layout;
1414
use crate::NdProducer;
1515
use crate::{ArrayBase, Data};
1616

@@ -193,12 +193,12 @@ impl<D: Dimension + Copy> NdProducer for Indices<D>
193193
IndexPtr { index: self.start }
194194
}
195195

196-
fn layout(&self) -> LayoutBitset
196+
fn layout(&self) -> Layout
197197
{
198198
if self.dim.ndim() <= 1 {
199-
LayoutBitset::one_dimensional()
199+
Layout::one_dimensional()
200200
} else {
201-
LayoutBitset::none()
201+
Layout::none()
202202
}
203203
}
204204

src/iterators/chunks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
33
use crate::imp_prelude::*;
44
use crate::Baseiter;
55
use crate::IntoDimension;
6-
use crate::{LayoutBitset, NdProducer};
6+
use crate::{Layout, NdProducer};
77

88
impl_ndproducer! {
99
['a, A, D: Dimension]

src/iterators/lanes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
33
use super::LanesIter;
44
use super::LanesIterMut;
55
use crate::imp_prelude::*;
6-
use crate::{LayoutBitset, NdProducer};
6+
use crate::{Layout, NdProducer};
77

88
impl_ndproducer! {
99
['a, A, D: Dimension]

src/iterators/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<$($typarm)*> NdProducer for $fulltype {
6767
self.$base.raw_dim()
6868
}
6969

70-
fn layout(&self) -> LayoutBitset {
70+
fn layout(&self) -> Layout {
7171
self.$base.layout()
7272
}
7373

src/iterators/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,9 +1191,9 @@ impl<A, D: Dimension> NdProducer for AxisIter<'_, A, D>
11911191
type Ptr = *mut A;
11921192
type Stride = isize;
11931193

1194-
fn layout(&self) -> crate::LayoutBitset
1194+
fn layout(&self) -> crate::Layout
11951195
{
1196-
crate::LayoutBitset::one_dimensional()
1196+
crate::Layout::one_dimensional()
11971197
}
11981198

11991199
fn raw_dim(&self) -> Self::Dim
@@ -1250,9 +1250,9 @@ impl<A, D: Dimension> NdProducer for AxisIterMut<'_, A, D>
12501250
type Ptr = *mut A;
12511251
type Stride = isize;
12521252

1253-
fn layout(&self) -> crate::LayoutBitset
1253+
fn layout(&self) -> crate::Layout
12541254
{
1255-
crate::LayoutBitset::one_dimensional()
1255+
crate::Layout::one_dimensional()
12561256
}
12571257

12581258
fn raw_dim(&self) -> Self::Dim

src/iterators/windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
33
use super::Baseiter;
44
use crate::imp_prelude::*;
55
use crate::IntoDimension;
6-
use crate::LayoutBitset;
6+
use crate::Layout;
77
use crate::NdProducer;
88
use crate::Slice;
99

@@ -176,7 +176,7 @@ impl<'a, A, D: Dimension> NdProducer for AxisWindows<'a, A, D>
176176
Ix1(self.base.raw_dim()[self.axis_idx])
177177
}
178178

179-
fn layout(&self) -> LayoutBitset
179+
fn layout(&self) -> Layout
180180
{
181181
self.base.layout()
182182
}

src/layout/layoutfmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use super::LayoutBitset;
9+
use super::Layout;
1010

1111
const LAYOUT_NAMES: &[&str] = &["C", "F", "c", "f"];
1212

1313
use std::fmt;
1414

15-
impl fmt::Debug for LayoutBitset
15+
impl fmt::Debug for Layout
1616
{
1717
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
1818
{

src/layout/mod.rs

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ mod layoutfmt;
66
#[doc(hidden)]
77
/// Memory layout description
88
#[derive(Copy, Clone)]
9-
pub struct LayoutBitset(u32);
9+
pub struct Layout(u32);
1010

11-
#[deprecated(since = "0.18.0", note = "Layout has been renamed to LayoutBitset")]
12-
#[allow(dead_code)]
13-
/// Memory layout description, deprecated. See [`LayoutBitset`] instead.
14-
pub type Layout = LayoutBitset;
15-
16-
impl LayoutBitset
11+
impl Layout
1712
{
1813
pub(crate) const CORDER: u32 = 0b01;
1914
pub(crate) const FORDER: u32 = 0b10;
@@ -28,61 +23,61 @@ impl LayoutBitset
2823

2924
/// Return layout common to both inputs
3025
#[inline(always)]
31-
pub(crate) fn intersect(self, other: LayoutBitset) -> LayoutBitset
26+
pub(crate) fn intersect(self, other: Layout) -> Layout
3227
{
33-
LayoutBitset(self.0 & other.0)
28+
Layout(self.0 & other.0)
3429
}
3530

3631
/// Return a layout that simultaneously "is" what both of the inputs are
3732
#[inline(always)]
38-
pub(crate) fn also(self, other: LayoutBitset) -> LayoutBitset
33+
pub(crate) fn also(self, other: Layout) -> Layout
3934
{
40-
LayoutBitset(self.0 | other.0)
35+
Layout(self.0 | other.0)
4136
}
4237

4338
#[inline(always)]
44-
pub(crate) fn one_dimensional() -> LayoutBitset
39+
pub(crate) fn one_dimensional() -> Layout
4540
{
46-
LayoutBitset::c().also(LayoutBitset::f())
41+
Layout::c().also(Layout::f())
4742
}
4843

4944
#[inline(always)]
50-
pub(crate) fn c() -> LayoutBitset
45+
pub(crate) fn c() -> Layout
5146
{
52-
LayoutBitset(LayoutBitset::CORDER | LayoutBitset::CPREFER)
47+
Layout(Layout::CORDER | Layout::CPREFER)
5348
}
5449

5550
#[inline(always)]
56-
pub(crate) fn f() -> LayoutBitset
51+
pub(crate) fn f() -> Layout
5752
{
58-
LayoutBitset(LayoutBitset::FORDER | LayoutBitset::FPREFER)
53+
Layout(Layout::FORDER | Layout::FPREFER)
5954
}
6055

6156
#[inline(always)]
62-
pub(crate) fn cpref() -> LayoutBitset
57+
pub(crate) fn cpref() -> Layout
6358
{
64-
LayoutBitset(LayoutBitset::CPREFER)
59+
Layout(Layout::CPREFER)
6560
}
6661

6762
#[inline(always)]
68-
pub(crate) fn fpref() -> LayoutBitset
63+
pub(crate) fn fpref() -> Layout
6964
{
70-
LayoutBitset(LayoutBitset::FPREFER)
65+
Layout(Layout::FPREFER)
7166
}
7267

7368
#[inline(always)]
74-
pub(crate) fn none() -> LayoutBitset
69+
pub(crate) fn none() -> Layout
7570
{
76-
LayoutBitset(0)
71+
Layout(0)
7772
}
7873

7974
/// A simple "score" method which scores positive for preferring C-order, negative for F-order
8075
/// Subject to change when we can describe other layouts
8176
#[inline]
8277
pub(crate) fn tendency(self) -> i32
8378
{
84-
(self.is(LayoutBitset::CORDER) as i32 - self.is(LayoutBitset::FORDER) as i32)
85-
+ (self.is(LayoutBitset::CPREFER) as i32 - self.is(LayoutBitset::FPREFER) as i32)
79+
(self.is(Layout::CORDER) as i32 - self.is(Layout::FORDER) as i32)
80+
+ (self.is(Layout::CPREFER) as i32 - self.is(Layout::FPREFER) as i32)
8681
}
8782
}
8883

@@ -101,7 +96,7 @@ mod tests
10196
($mat:expr, $($layout:ident),*) => {{
10297
let layout = $mat.view().layout();
10398
$(
104-
assert!(layout.is(LayoutBitset::$layout),
99+
assert!(layout.is(Layout::$layout),
105100
"Assertion failed: array {:?} is not layout {}",
106101
$mat,
107102
stringify!($layout));
@@ -113,7 +108,7 @@ mod tests
113108
($mat:expr, $($layout:ident),*) => {{
114109
let layout = $mat.view().layout();
115110
$(
116-
assert!(!layout.is(LayoutBitset::$layout),
111+
assert!(!layout.is(Layout::$layout),
117112
"Assertion failed: array {:?} show not have layout {}",
118113
$mat,
119114
stringify!($layout));
@@ -128,10 +123,10 @@ mod tests
128123
let b = M::zeros((5, 5).f());
129124
let ac = a.view().layout();
130125
let af = b.view().layout();
131-
assert!(ac.is(LayoutBitset::CORDER) && ac.is(LayoutBitset::CPREFER));
132-
assert!(!ac.is(LayoutBitset::FORDER) && !ac.is(LayoutBitset::FPREFER));
133-
assert!(!af.is(LayoutBitset::CORDER) && !af.is(LayoutBitset::CPREFER));
134-
assert!(af.is(LayoutBitset::FORDER) && af.is(LayoutBitset::FPREFER));
126+
assert!(ac.is(Layout::CORDER) && ac.is(Layout::CPREFER));
127+
assert!(!ac.is(Layout::FORDER) && !ac.is(Layout::FPREFER));
128+
assert!(!af.is(Layout::CORDER) && !af.is(Layout::CPREFER));
129+
assert!(af.is(Layout::FORDER) && af.is(Layout::FPREFER));
135130
}
136131

137132
#[test]
@@ -172,10 +167,10 @@ mod tests
172167
let v1 = a.slice(s![1.., ..]).layout();
173168
let v2 = a.slice(s![.., 1..]).layout();
174169

175-
assert!(v1.is(LayoutBitset::CORDER) && v1.is(LayoutBitset::CPREFER));
176-
assert!(!v1.is(LayoutBitset::FORDER) && !v1.is(LayoutBitset::FPREFER));
177-
assert!(!v2.is(LayoutBitset::CORDER) && v2.is(LayoutBitset::CPREFER));
178-
assert!(!v2.is(LayoutBitset::FORDER) && !v2.is(LayoutBitset::FPREFER));
170+
assert!(v1.is(Layout::CORDER) && v1.is(Layout::CPREFER));
171+
assert!(!v1.is(Layout::FORDER) && !v1.is(Layout::FPREFER));
172+
assert!(!v2.is(Layout::CORDER) && v2.is(Layout::CPREFER));
173+
assert!(!v2.is(Layout::FORDER) && !v2.is(Layout::FPREFER));
179174
}
180175

181176
let b = M::zeros((5, 5).f());
@@ -184,10 +179,10 @@ mod tests
184179
let v1 = b.slice(s![1.., ..]).layout();
185180
let v2 = b.slice(s![.., 1..]).layout();
186181

187-
assert!(!v1.is(LayoutBitset::CORDER) && !v1.is(LayoutBitset::CPREFER));
188-
assert!(!v1.is(LayoutBitset::FORDER) && v1.is(LayoutBitset::FPREFER));
189-
assert!(!v2.is(LayoutBitset::CORDER) && !v2.is(LayoutBitset::CPREFER));
190-
assert!(v2.is(LayoutBitset::FORDER) && v2.is(LayoutBitset::FPREFER));
182+
assert!(!v1.is(Layout::CORDER) && !v1.is(Layout::CPREFER));
183+
assert!(!v1.is(Layout::FORDER) && v1.is(Layout::FPREFER));
184+
assert!(!v2.is(Layout::CORDER) && !v2.is(Layout::CPREFER));
185+
assert!(v2.is(Layout::FORDER) && v2.is(Layout::FPREFER));
191186
}
192187
}
193188

@@ -228,21 +223,21 @@ mod tests
228223
let v1 = a.slice(s![..;2, ..]).layout();
229224
let v2 = a.slice(s![.., ..;2]).layout();
230225

231-
assert!(!v1.is(LayoutBitset::CORDER) && v1.is(LayoutBitset::CPREFER));
232-
assert!(!v1.is(LayoutBitset::FORDER) && !v1.is(LayoutBitset::FPREFER));
233-
assert!(!v2.is(LayoutBitset::CORDER) && !v2.is(LayoutBitset::CPREFER));
234-
assert!(!v2.is(LayoutBitset::FORDER) && !v2.is(LayoutBitset::FPREFER));
226+
assert!(!v1.is(Layout::CORDER) && v1.is(Layout::CPREFER));
227+
assert!(!v1.is(Layout::FORDER) && !v1.is(Layout::FPREFER));
228+
assert!(!v2.is(Layout::CORDER) && !v2.is(Layout::CPREFER));
229+
assert!(!v2.is(Layout::FORDER) && !v2.is(Layout::FPREFER));
235230
}
236231

237232
let b = M::zeros((5, 5).f());
238233
{
239234
let v1 = b.slice(s![..;2, ..]).layout();
240235
let v2 = b.slice(s![.., ..;2]).layout();
241236

242-
assert!(!v1.is(LayoutBitset::CORDER) && !v1.is(LayoutBitset::CPREFER));
243-
assert!(!v1.is(LayoutBitset::FORDER) && !v1.is(LayoutBitset::FPREFER));
244-
assert!(!v2.is(LayoutBitset::CORDER) && !v2.is(LayoutBitset::CPREFER));
245-
assert!(!v2.is(LayoutBitset::FORDER) && v2.is(LayoutBitset::FPREFER));
237+
assert!(!v1.is(Layout::CORDER) && !v1.is(Layout::CPREFER));
238+
assert!(!v1.is(Layout::FORDER) && !v1.is(Layout::FPREFER));
239+
assert!(!v2.is(Layout::CORDER) && !v2.is(Layout::CPREFER));
240+
assert!(!v2.is(Layout::FORDER) && v2.is(Layout::FPREFER));
246241
}
247242
}
248243
}

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ mod dimension;
222222

223223
pub use crate::zip::{FoldWhile, IntoNdProducer, NdProducer, Zip};
224224

225-
#[allow(deprecated)]
226-
pub use crate::layout::{Layout, LayoutBitset};
225+
pub use crate::layout::Layout;
227226

228227
/// Implementation's prelude. Common types used everywhere.
229228
mod imp_prelude

src/parallel/send_producer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::imp_prelude::*;
2-
use crate::{LayoutBitset, NdProducer};
2+
use crate::{Layout, NdProducer};
33
use std::ops::{Deref, DerefMut};
44

55
/// An NdProducer that is unconditionally `Send`.
@@ -66,7 +66,7 @@ where P: NdProducer
6666
}
6767

6868
#[inline(always)]
69-
fn layout(&self) -> LayoutBitset
69+
fn layout(&self) -> Layout
7070
{
7171
self.inner.layout()
7272
}

0 commit comments

Comments
 (0)