Skip to content

Commit 828b274

Browse files
committed
Rename sum, product to horizontal_{sum,product}
1 parent 01d78aa commit 828b274

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

crates/core_simd/src/reduction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ macro_rules! impl_integer_reductions {
66
{
77
/// Horizontal wrapping add. Returns the sum of the lanes of the vector, with wrapping addition.
88
#[inline]
9-
pub fn wrapping_sum(self) -> $scalar {
9+
pub fn horizontal_wrapping_sum(self) -> $scalar {
1010
unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0) }
1111
}
1212

1313
/// Horizontal wrapping multiply. Returns the product of the lanes of the vector, with wrapping multiplication.
1414
#[inline]
15-
pub fn wrapping_product(self) -> $scalar {
15+
pub fn horizontal_wrapping_product(self) -> $scalar {
1616
unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1) }
1717
}
1818

@@ -61,7 +61,7 @@ macro_rules! impl_float_reductions {
6161

6262
/// Horizontal add. Returns the sum of the lanes of the vector.
6363
#[inline]
64-
pub fn sum(self) -> $scalar {
64+
pub fn horizontal_sum(self) -> $scalar {
6565
// LLVM sum is inaccurate on i586
6666
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) {
6767
self.as_slice().iter().sum()
@@ -72,7 +72,7 @@ macro_rules! impl_float_reductions {
7272

7373
/// Horizontal multiply. Returns the product of the lanes of the vector.
7474
#[inline]
75-
pub fn product(self) -> $scalar {
75+
pub fn horizontal_product(self) -> $scalar {
7676
// LLVM product is inaccurate on i586
7777
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) {
7878
self.as_slice().iter().product()

crates/core_simd/tests/ops_macros.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,20 @@ macro_rules! impl_binary_checked_op_test {
140140
macro_rules! impl_common_integer_tests {
141141
{ $vector:ident, $scalar:ident } => {
142142
test_helpers::test_lanes! {
143-
fn wrapping_sum<const LANES: usize>() {
143+
fn horizontal_wrapping_sum<const LANES: usize>() {
144144
test_helpers::test_1(&|x| {
145145
test_helpers::prop_assert_biteq! (
146-
$vector::<LANES>::from_array(x).wrapping_sum(),
146+
$vector::<LANES>::from_array(x).horizontal_wrapping_sum(),
147147
x.iter().copied().fold(0 as $scalar, $scalar::wrapping_add),
148148
);
149149
Ok(())
150150
});
151151
}
152152

153-
fn wrapping_product<const LANES: usize>() {
153+
fn horizontal_wrapping_product<const LANES: usize>() {
154154
test_helpers::test_1(&|x| {
155155
test_helpers::prop_assert_biteq! (
156-
$vector::<LANES>::from_array(x).wrapping_product(),
156+
$vector::<LANES>::from_array(x).horizontal_wrapping_product(),
157157
x.iter().copied().fold(1 as $scalar, $scalar::wrapping_mul),
158158
);
159159
Ok(())
@@ -479,20 +479,20 @@ macro_rules! impl_float_tests {
479479
).unwrap();
480480
}
481481

482-
fn sum<const LANES: usize>() {
482+
fn horizontal_sum<const LANES: usize>() {
483483
test_helpers::test_1(&|x| {
484484
test_helpers::prop_assert_biteq! (
485-
Vector::<LANES>::from_array(x).sum(),
485+
Vector::<LANES>::from_array(x).horizontal_sum(),
486486
x.iter().sum(),
487487
);
488488
Ok(())
489489
});
490490
}
491491

492-
fn product<const LANES: usize>() {
492+
fn horizontal_product<const LANES: usize>() {
493493
test_helpers::test_1(&|x| {
494494
test_helpers::prop_assert_biteq! (
495-
Vector::<LANES>::from_array(x).product(),
495+
Vector::<LANES>::from_array(x).horizontal_product(),
496496
x.iter().product(),
497497
);
498498
Ok(())

0 commit comments

Comments
 (0)