Apply suggestions from code review

Co-authored-by: Lokathor <zefria@gmail.com>
This commit is contained in:
Caleb Zulawski
2020-09-23 08:11:43 -04:00
committed by GitHub
parent 0f837a9147
commit c74eec7e25
2 changed files with 6 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
#![feature(repr_simd)] #![feature(repr_simd)]
#![warn(missing_docs)]
#[macro_use] #[macro_use]
mod macros; mod macros;

View File

@@ -69,6 +69,7 @@ macro_rules! define_type {
// splat // splat
impl From<$type> for $name { impl From<$type> for $name {
#[inline]
fn from(value: $type) -> Self { fn from(value: $type) -> Self {
Self::splat(value) Self::splat(value)
} }
@@ -126,16 +127,16 @@ macro_rules! define_type {
pub struct $name($($itype),*); pub struct $name($($itype),*);
impl $name { impl $name {
/// Construct a vector by setting each lane to a single value. /// Construct a vector by setting all lanes to the given value.
#[inline] #[inline]
pub fn splat(value: $type) -> Self { pub const fn splat(value: $type) -> Self {
Self($(value as $itype),*) Self($(value as $itype),*)
} }
/// Construct a vector by setting each lane. /// Construct a vector by setting each lane to the given values.
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[inline] #[inline]
pub fn new($($ivar: $itype),*) -> Self { pub const fn new($($ivar: $itype),*) -> Self {
Self($($ivar),*) Self($($ivar),*)
} }
} }