Skip to content

Commit a55de27

Browse files
committed
reductions should take self
1 parent a8852b7 commit a55de27

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

coresimd/ppvt/api/arithmetic_reductions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ macro_rules! impl_arithmetic_reductions {
55
impl $id {
66
/// Lane-wise addition of the vector elements.
77
#[inline(always)]
8-
pub fn add(&self) -> $elem_ty {
8+
pub fn add(self) -> $elem_ty {
99
let mut r = self.extract(0);
1010
for i in 1..$id::lanes() {
1111
r += self.extract(i);
@@ -14,7 +14,7 @@ macro_rules! impl_arithmetic_reductions {
1414
}
1515
/// Lane-wise substraction of the vector elements.
1616
#[inline(always)]
17-
pub fn sub(&self) -> $elem_ty {
17+
pub fn sub(self) -> $elem_ty {
1818
let mut r = self.extract(0);
1919
for i in 1..$id::lanes() {
2020
r -= self.extract(i);
@@ -23,7 +23,7 @@ macro_rules! impl_arithmetic_reductions {
2323
}
2424
/// Lane-wise multiplication of the vector elements.
2525
#[inline(always)]
26-
pub fn mul(&self) -> $elem_ty {
26+
pub fn mul(self) -> $elem_ty {
2727
let mut r = self.extract(0);
2828
for i in 1..$id::lanes() {
2929
r *= self.extract(i);
@@ -32,7 +32,7 @@ macro_rules! impl_arithmetic_reductions {
3232
}
3333
/// Lane-wise division of the vector elements.
3434
#[inline(always)]
35-
pub fn div(&self) -> $elem_ty {
35+
pub fn div(self) -> $elem_ty {
3636
let mut r = self.extract(0);
3737
for i in 1..$id::lanes() {
3838
r /= self.extract(i);
@@ -41,7 +41,7 @@ macro_rules! impl_arithmetic_reductions {
4141
}
4242
/// Lane-wise remainder of the vector elements.
4343
#[inline(always)]
44-
pub fn rem(&self) -> $elem_ty {
44+
pub fn rem(self) -> $elem_ty {
4545
let mut r = self.extract(0);
4646
for i in 1..$id::lanes() {
4747
r %= self.extract(i);

coresimd/ppvt/api/bitwise_reductions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ macro_rules! impl_bitwise_reductions {
44
($id:ident, $elem_ty:ident) => {
55
impl $id {
66
/// Lane-wise bitwise `and` of the vector elements.
7-
pub fn and(&self) -> $elem_ty {
7+
pub fn and(self) -> $elem_ty {
88
let mut r = self.extract(0);
99
for i in 1..$id::lanes() {
1010
r &= self.extract(i);
1111
}
1212
r
1313
}
1414
/// Lane-wise bitwise `or` of the vector elements.
15-
pub fn or(&self) -> $elem_ty {
15+
pub fn or(self) -> $elem_ty {
1616
let mut r = self.extract(0);
1717
for i in 1..$id::lanes() {
1818
r |= self.extract(i);
1919
}
2020
r
2121
}
2222
/// Lane-wise bitwise `xor` of the vector elements.
23-
pub fn xor(&self) -> $elem_ty {
23+
pub fn xor(self) -> $elem_ty {
2424
let mut r = self.extract(0);
2525
for i in 1..$id::lanes() {
2626
r ^= self.extract(i);

coresimd/ppvt/api/boolean_reductions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ macro_rules! impl_bool_reductions {
55
impl $id {
66
/// Are `all` vector lanes `true`?
77
#[inline(always)]
8-
pub fn all(&self) -> bool {
8+
pub fn all(self) -> bool {
99
self.and()
1010
}
1111
/// Is `any` vector lanes `true`?
1212
#[inline(always)]
13-
pub fn any(&self) -> bool {
13+
pub fn any(self) -> bool {
1414
self.or()
1515
}
1616
/// Are `all` vector lanes `false`?
1717
#[inline(always)]
18-
pub fn none(&self) -> bool {
18+
pub fn none(self) -> bool {
1919
!self.or()
2020
}
2121
}

coresimd/ppvt/api/minmax_reductions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ macro_rules! impl_minmax_reductions {
66
/// Largest vector value.
77
#[inline(always)]
88
#[allow(unused_imports)]
9-
pub fn max(&self) -> $elem_ty {
9+
pub fn max(self) -> $elem_ty {
1010
use num::Float;
1111
let mut r = self.extract(0);
1212
for i in 1..$id::lanes() {
@@ -17,7 +17,7 @@ macro_rules! impl_minmax_reductions {
1717
/// Smallest vector value.
1818
#[inline(always)]
1919
#[allow(unused_imports)]
20-
pub fn min(&self) -> $elem_ty {
20+
pub fn min(self) -> $elem_ty {
2121
use num::Float;
2222
let mut r = self.extract(0);
2323
for i in 1..$id::lanes() {

0 commit comments

Comments
 (0)