Add comparison ops

This commit is contained in:
Caleb Zulawski
2020-10-28 16:27:15 -04:00
parent cebc2ca707
commit 5bc5d7f0d1
5 changed files with 414 additions and 83 deletions

View File

@@ -336,6 +336,24 @@ macro_rules! define_mask_vector {
call_repeat! { $lanes => define_mask_vector [$impl_type] splat $type | }
call_counting_args! { $lanes => define_mask_vector => new $type | }
call_counting_args! { $lanes => define_mask_vector => new_from_bool $type | }
/// Tests the value of the specified lane.
///
/// # Panics
/// Panics if `lane` is greater than or equal to the number of lanes in the vector.
#[inline]
pub fn test(&self, lane: usize) -> bool {
self[lane].test()
}
/// Sets the value of the specified lane.
///
/// # Panics
/// Panics if `lane` is greater than or equal to the number of lanes in the vector.
#[inline]
pub fn set(&mut self, lane: usize, value: bool) {
self[lane] = value.into();
}
}
base_vector_traits! { $name => [$type; $lanes] }