Skip to content

Commit 4231f44

Browse files
committed
Add Accuracy parameter to zip_common
1 parent ba7356a commit 4231f44

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

include/kernel_float/binops.h

+13-6
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ using zip_common_type = vector<
4444
* vec<float, 3> c = zip_common([](float x, float y){ return x + y; }, a, b); // returns [5.0f, 7.0f, 9.0f]
4545
* ```
4646
*/
47-
template<typename F, typename L, typename R>
47+
template<typename Accuracy = default_policy, typename F, typename L, typename R>
4848
KERNEL_FLOAT_INLINE zip_common_type<F, L, R> zip_common(F fun, const L& left, const R& right) {
4949
using T = promoted_vector_value_type<L, R>;
5050
using O = result_t<F, T, T>;
5151
using E = broadcast_vector_extent_type<L, R>;
5252

5353
vector_storage<O, extent_size<E>> result;
5454

55-
detail::default_map_impl<F, extent_size<E>, O, T, T>::call(
55+
detail::map_impl<Accuracy, F, extent_size<E>, O, T, T>::call(
5656
fun,
5757
result.data(),
5858
detail::convert_impl<vector_value_type<L>, vector_extent_type<L>, T, E>::call(
@@ -65,10 +65,17 @@ KERNEL_FLOAT_INLINE zip_common_type<F, L, R> zip_common(F fun, const L& left, co
6565
return result;
6666
}
6767

68-
#define KERNEL_FLOAT_DEFINE_BINARY_FUN(NAME) \
69-
template<typename L, typename R, typename C = promoted_vector_value_type<L, R>> \
70-
KERNEL_FLOAT_INLINE zip_common_type<ops::NAME<C>, L, R> NAME(L&& left, R&& right) { \
71-
return zip_common(ops::NAME<C> {}, static_cast<L&&>(left), static_cast<R&&>(right)); \
68+
#define KERNEL_FLOAT_DEFINE_BINARY_FUN(NAME) \
69+
template< \
70+
typename Accuracy = default_policy, \
71+
typename L, \
72+
typename R, \
73+
typename C = promoted_vector_value_type<L, R>> \
74+
KERNEL_FLOAT_INLINE zip_common_type<ops::NAME<C>, L, R> NAME(L&& left, R&& right) { \
75+
return zip_common<Accuracy>( \
76+
ops::NAME<C> {}, \
77+
static_cast<L&&>(left), \
78+
static_cast<R&&>(right)); \
7279
}
7380

7481
#define KERNEL_FLOAT_DEFINE_BINARY(NAME, EXPR, EXPR_F64, EXPR_F32) \

0 commit comments

Comments
 (0)