Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions mlx/backend/metal/kernels/steel/utils/integral_constant.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ using Int = integral_constant<int, val>;
// Binary Operators on Integral constants
///////////////////////////////////////////////////////////////////////////////

#define integral_const_binop(__op__, __operator__) \
template <typename T, T tv, typename U, U uv> \
METAL_FUNC constexpr auto __operator__( \
integral_constant<T, tv>, integral_constant<U, uv>) { \
constexpr auto res = tv __op__ uv; \
using res_t = metal::remove_addrspace_t<decltype(res)>; \
return integral_constant<res_t, res>{}; \
#define integral_const_binop(__op__, __operator__) \
template <typename T, T tv, typename U, U uv> \
METAL_FUNC constexpr auto __operator__( \
integral_constant<T, tv>, integral_constant<U, uv>) { \
return integral_constant<const decltype(tv __op__ uv), (tv __op__ uv)>{}; \
}

integral_const_binop(+, operator+);
Expand Down