MLX
Loading...
Searching...
No Matches
integral_constant.h File Reference
#include <metal_stdlib>
#include "mlx/backend/metal/kernels/steel/utils/type_traits.h"

Go to the source code of this file.

Classes

struct  mlx::steel::integral_constant< T, v >
 
struct  mlx::steel::is_integral< T >
 
struct  mlx::steel::is_integral< integral_constant< T, v > >
 

Namespaces

namespace  mlx
 
namespace  mlx::steel
 

Macros

#define integral_const_binop(__op__, __operator__)
 

Typedefs

template<bool B>
using mlx::steel::bool_constant = integral_constant<bool, B>
 
using mlx::steel::true_type = bool_constant<true>
 
using mlx::steel::false_type = bool_constant<false>
 
template<int val>
using mlx::steel::Int = integral_constant<int, val>
 

Functions

template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator+ (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator- (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator* (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator/ (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator== (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator!= (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator< (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator> (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator<= (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator>= (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator&& (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T , T tv, typename U , U uv>
METAL_FUNC constexpr auto mlx::steel::operator|| (integral_constant< T, tv >, integral_constant< U, uv >)
 
template<typename T >
METAL_FUNC constexpr T mlx::steel::sum (T x)
 
template<typename T , typename... Us>
METAL_FUNC constexpr auto mlx::steel::sum (T x, Us... us)
 

Variables

template<typename T >
constexpr constant bool mlx::steel::is_integral_v = is_integral<T>::value
 

Macro Definition Documentation

◆ integral_const_binop

#define integral_const_binop ( __op__,
__operator__ )
Value:
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; \
return integral_constant<decltype(res), res>{}; \
}