1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
mod layoutfmt;
#[doc(hidden)]
#[derive(Copy, Clone)]
pub struct Layout(u32);
pub trait LayoutPriv : Sized {
fn new(x: u32) -> Self;
fn and(self, flag: Self) -> Self;
fn is(self, flag: u32) -> bool;
fn flag(self) -> u32;
}
impl LayoutPriv for Layout {
#[inline(always)]
fn new(x: u32) -> Self { Layout(x) }
#[inline(always)]
fn is(self, flag: u32) -> bool {
self.0 & flag != 0
}
#[inline(always)]
fn and(self, flag: Layout) -> Layout {
Layout(self.0 & flag.0)
}
#[inline(always)]
fn flag(self) -> u32 {
self.0
}
}
impl Layout {
#[doc(hidden)]
#[inline(always)]
pub fn one_dimensional() -> Layout {
Layout(CORDER | FORDER)
}
#[doc(hidden)]
#[inline(always)]
pub fn c() -> Layout {
Layout(CORDER)
}
#[doc(hidden)]
#[inline(always)]
pub fn f() -> Layout {
Layout(FORDER)
}
#[inline(always)]
#[doc(hidden)]
pub fn none() -> Layout {
Layout(0)
}
}
pub const CORDER: u32 = 1 << 0;
pub const FORDER: u32 = 1 << 1;