forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from rust-lang/feature/initial-types
Feature/initial types
- Loading branch information
Showing
27 changed files
with
963 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
|
||
members = [ | ||
"crates/core_simd", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "core_simd" | ||
version = "0.1.0" | ||
authors = ["Caleb Zulawski <caleb.zulawski@gmail.com>"] | ||
edition = "2018" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
macro_rules! debug_wrapper { | ||
{ $($trait:ident => $name:ident,)* } => { | ||
$( | ||
pub(crate) fn $name<T: core::fmt::$trait>(slice: &[T], f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
#[repr(transparent)] | ||
struct Wrapper<'a, T: core::fmt::$trait>(&'a T); | ||
|
||
impl<T: core::fmt::$trait> core::fmt::Debug for Wrapper<'_, T> { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
self.0.fmt(f) | ||
} | ||
} | ||
|
||
f.debug_list() | ||
.entries(slice.iter().map(|x| Wrapper(x))) | ||
.finish() | ||
} | ||
)* | ||
} | ||
} | ||
|
||
debug_wrapper! { | ||
Debug => format, | ||
Binary => format_binary, | ||
LowerExp => format_lower_exp, | ||
UpperExp => format_upper_exp, | ||
Octal => format_octal, | ||
LowerHex => format_lower_hex, | ||
UpperHex => format_upper_hex, | ||
} | ||
|
||
macro_rules! impl_fmt_trait { | ||
{ $($type:ty => $(($trait:ident, $format:ident)),*;)* } => { | ||
$( // repeat type | ||
$( // repeat trait | ||
impl core::fmt::$trait for $type { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
$format(self.as_ref(), f) | ||
} | ||
} | ||
)* | ||
)* | ||
}; | ||
{ integers: $($type:ty,)* } => { | ||
impl_fmt_trait! { | ||
$($type => | ||
(Debug, format), | ||
(Binary, format_binary), | ||
(LowerExp, format_lower_exp), | ||
(UpperExp, format_upper_exp), | ||
(Octal, format_octal), | ||
(LowerHex, format_lower_hex), | ||
(UpperHex, format_upper_hex); | ||
)* | ||
} | ||
}; | ||
{ floats: $($type:ty,)* } => { | ||
impl_fmt_trait! { | ||
$($type => | ||
(Debug, format), | ||
(LowerExp, format_lower_exp), | ||
(UpperExp, format_upper_exp); | ||
)* | ||
} | ||
}; | ||
{ masks: $($type:ty,)* } => { | ||
impl_fmt_trait! { | ||
$($type => | ||
(Debug, format); | ||
)* | ||
} | ||
} | ||
} | ||
|
||
impl_fmt_trait! { | ||
integers: | ||
crate::u8x8, crate::u8x16, crate::u8x32, crate::u8x64, | ||
crate::i8x8, crate::i8x16, crate::i8x32, crate::i8x64, | ||
crate::u16x4, crate::u16x8, crate::u16x16, crate::u16x32, | ||
crate::i16x4, crate::i16x8, crate::i16x16, crate::i16x32, | ||
crate::u32x2, crate::u32x4, crate::u32x8, crate::u32x16, | ||
crate::i32x2, crate::i32x4, crate::i32x8, crate::i32x16, | ||
crate::u64x2, crate::u64x4, crate::u64x8, | ||
crate::i64x2, crate::i64x4, crate::i64x8, | ||
crate::u128x2, crate::u128x4, | ||
crate::i128x2, crate::i128x4, | ||
crate::usizex2, crate::usizex4, crate::usizex8, | ||
crate::isizex2, crate::isizex4, crate::isizex8, | ||
} | ||
|
||
impl_fmt_trait! { | ||
floats: | ||
crate::f32x2, crate::f32x4, crate::f32x8, crate::f32x16, | ||
crate::f64x2, crate::f64x4, crate::f64x8, | ||
} | ||
|
||
impl_fmt_trait! { | ||
masks: | ||
crate::mask8x8, crate::mask8x16, crate::mask8x32, crate::mask8x64, | ||
crate::mask16x4, crate::mask16x8, crate::mask16x16, crate::mask16x32, | ||
crate::mask32x2, crate::mask32x4, crate::mask32x8, crate::mask32x16, | ||
crate::mask64x2, crate::mask64x4, crate::mask64x8, | ||
crate::mask128x2, crate::mask128x4, | ||
crate::masksizex2, crate::masksizex4, crate::masksizex8, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#![no_std] | ||
#![feature(repr_simd)] | ||
#![warn(missing_docs)] | ||
//! Portable SIMD module. | ||
#[macro_use] | ||
mod macros; | ||
|
||
mod fmt; | ||
|
||
mod masks; | ||
pub use masks::*; | ||
|
||
mod vectors_u8; | ||
pub use vectors_u8::*; | ||
mod vectors_u16; | ||
pub use vectors_u16::*; | ||
mod vectors_u32; | ||
pub use vectors_u32::*; | ||
mod vectors_u64; | ||
pub use vectors_u64::*; | ||
mod vectors_u128; | ||
pub use vectors_u128::*; | ||
mod vectors_usize; | ||
pub use vectors_usize::*; | ||
|
||
mod vectors_i8; | ||
pub use vectors_i8::*; | ||
mod vectors_i16; | ||
pub use vectors_i16::*; | ||
mod vectors_i32; | ||
pub use vectors_i32::*; | ||
mod vectors_i64; | ||
pub use vectors_i64::*; | ||
mod vectors_i128; | ||
pub use vectors_i128::*; | ||
mod vectors_isize; | ||
pub use vectors_isize::*; | ||
|
||
mod vectors_f32; | ||
pub use vectors_f32::*; | ||
mod vectors_f64; | ||
pub use vectors_f64::*; | ||
|
||
mod vectors_mask8; | ||
pub use vectors_mask8::*; | ||
mod vectors_mask16; | ||
pub use vectors_mask16::*; | ||
mod vectors_mask32; | ||
pub use vectors_mask32::*; | ||
mod vectors_mask64; | ||
pub use vectors_mask64::*; | ||
mod vectors_mask128; | ||
pub use vectors_mask128::*; | ||
mod vectors_masksize; | ||
pub use vectors_masksize::*; |
Oops, something went wrong.