22using as_uint_type = std::conditional_t<
sizeof(
T) ==
sizeof(uint8_t), uint8_t,
23 std::conditional_t<
sizeof(
T) ==
sizeof(uint16_t), uint16_t,
24 std::conditional_t<
sizeof(
T) ==
sizeof(uint32_t), uint32_t,
48 BLI_STATIC_ASSERT(T::type_length <= 4,
"Longer types need to implement vector_hash themself.");
49 const typename T::uint_type &uvec = *
reinterpret_cast<const typename T::uint_type *
>(&vec);
52 if constexpr (T::type_length > 1) {
55 if constexpr (T::type_length > 2) {
58 if constexpr (T::type_length > 3) {
69 "VecBase is not compatible with aligned type for now.");
72#define BLI_ENABLE_IF_VEC(_size, _test) int S = _size, BLI_ENABLE_IF((S _test))
81 template<BLI_ENABLE_IF_VEC(Size, > 1)>
explicit VecBase(
T value)
83 for (
int i = 0;
i < Size;
i++) {
88 template<
typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))>
93 template<BLI_ENABLE_IF_VEC(Size, == 1)>
VecBase(
T _x)
98 template<BLI_ENABLE_IF_VEC(Size, == 2)>
VecBase(
T _x,
T _y)
104 template<BLI_ENABLE_IF_VEC(Size, == 3)>
VecBase(
T _x,
T _y,
T _z)
111 template<BLI_ENABLE_IF_VEC(Size, == 4)>
VecBase(
T _x,
T _y,
T _z,
T _w)
121 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 3)>
126 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 3)>
131 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
136 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
141 template<
typename U,
typename V, BLI_ENABLE_IF_VEC(Size, == 4)>
146 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
151 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
156 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
166 template<
typename U,
int OtherSize, BLI_ENABLE_IF(OtherSize < Size)>
167 VecBase(const VecBase<U, OtherSize> &other) = delete;
171 template<
typename U,
int OtherSize, BLI_ENABLE_IF(OtherSize > Size)>
174 for (
int i = 0;
i < Size;
i++) {
175 (*this)[
i] =
T(other[
i]);
188 return *
reinterpret_cast<const VecBase<T, 2> *
>(&((*this)[1]));
193 return *
reinterpret_cast<const VecBase<T, 2> *
>(&((*this)[2]));
203 return *
reinterpret_cast<const VecBase<T, 3> *
>(&((*this)[1]));
211#undef BLI_ENABLE_IF_VEC
219# pragma GCC diagnostic push
220# pragma GCC diagnostic ignored "-Warray-bounds"
228 template<
typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))>
explicit VecBase(
const U *
ptr)
236# pragma GCC diagnostic pop
248 operator const T *()
const
250 return reinterpret_cast<const T *
>(
this);
255 return reinterpret_cast<T *
>(
this);
264 return reinterpret_cast<const T *
>(
this)[index];
271 return reinterpret_cast<T *
>(
this)[index];
276#define BLI_INT_OP(_T) template<typename U = _T, BLI_ENABLE_IF((std::is_integral_v<U>))>
362 for (
int i = 0;
i < Size;
i++) {
376 for (
int i = 0;
i < Size;
i++) {
390 for (
int i = 0;
i < Size;
i++) {
524 for (
int i = 0;
i < Size;
i++) {
538 for (
int i = 0;
i < Size;
i++) {
550 for (
int i = 0;
i < Size;
i++) {
573 for (
int i = 0;
i < Size;
i++) {
#define BLI_STATIC_ASSERT(a, msg)
#define BLI_UNROLL_MATH_VEC_OP_INIT_INDEX(a)
#define BLI_UNROLL_MATH_VEC_OP_VEC_SCALAR(op, a, b)
#define BLI_UNROLL_MATH_VEC_OP_VEC(op, a)
#define BLI_UNROLL_MATH_VEC_OP_SCALAR_VEC(op, a, b)
#define BLI_UNROLL_MATH_VEC_OP_VEC_VEC(op, a, b)
#define BLI_UNROLL_MATH_VEC_OP_ASSIGN_SCALAR(op, b)
#define BLI_UNROLL_MATH_VEC_OP_INIT_VECTOR(a)
#define BLI_UNROLL_MATH_VEC_OP_ASSIGN_VEC(op, b)
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned long long int uint64_t
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
ccl_device_inline float4 operator^(const float4 a, const float4 b)
ccl_device_inline int2 operator&(const int2 a, const int2 b)
ccl_device_inline int2 operator>>(const int2 a, const int i)
ccl_device_inline int4 & operator|=(int4 &a, const int4 b)
ccl_device_inline int4 & operator&=(int4 &a, const int4 b)
ccl_device_inline int4 operator|(const int4 a, const int4 b)
ccl_device_inline int4 & operator>>=(int4 &a, const int32_t b)
ccl_device_inline int4 & operator<<=(int4 &a, const int32_t b)
ccl_device_inline int4 & operator^=(int4 &a, const int4 b)
GPUState operator~(const GPUState &a)
uint64_t vector_hash(const T &vec)
VecBase< uint32_t, 2 > uint2
blender::VecBase< uint8_t, 2 > uchar2
blender::VecBase< int8_t, 2 > char2
VecBase< float, 1 > float1
VecBase< int32_t, 4 > int4
bool operator!=(const CPPType &a, const CPPType &b)
blender::VecBase< uint8_t, 3 > uchar3
blender::VecBase< int16_t, 3 > short3
VecBase< uint32_t, 4 > uint4
VecBase< double, 2 > double2
std::ostream & operator<<(std::ostream &stream, const eAlpha &space)
VecBase< uint32_t, 3 > uint3
blender::VecBase< int16_t, 4 > short4
blender::VecBase< uint8_t, 4 > uchar4
VecBase< float, 4 > float4
blender::VecBase< int8_t, 4 > char4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
blender::VecBase< uint16_t, 3 > ushort3
std::conditional_t< sizeof(T)==sizeof(uint8_t), uint8_t, std::conditional_t< sizeof(T)==sizeof(uint16_t), uint16_t, std::conditional_t< sizeof(T)==sizeof(uint32_t), uint32_t, std::conditional_t< sizeof(T)==sizeof(uint64_t), uint64_t, void > > > > as_uint_type
VecBase< uint16_t, 2 > ushort2
VecBase< double, 3 > double3
blender::VecBase< int8_t, 3 > char3
blender::VecBase< uint16_t, 4 > ushort4
VecBase< float, 3 > float3
blender::VecBase< int16_t, 2 > short2
VecBase< double, 4 > double4
bool operator==(const CPPType &a, const CPPType &b)
VecBase< as_uint_type< T >, Size > uint_type
constexpr VecBase(const VecBase< U, 2 > &xy, T z)
VecBase< T, 4 > xyzw() const
VecBase< T, 2 > zw() const
const T & operator[](int index) const
VecBase< T, 3 > yzw() const
friend VecBase operator-(const T &a, const VecBase &b)
friend VecBase operator-(const VecBase &a, const VecBase &b)
VecBase(const VecBase< U, OtherSize > &other)
BLI_STATIC_ASSERT(alignof(T)<=sizeof(T), "VecBase is not compatible with aligned type for now.")
friend VecBase operator/(const VecBase &a, T b)
friend VecBase operator*(const VecBase &a, FactorT b)
static constexpr int type_length
VecBase & operator-=(const T &b) &
friend VecBase operator*(const VecBase &a, const VecBase &b)
friend VecBase operator/(T a, const VecBase &b)
VecBase(T _x, T _y, T _z)
VecBase(T x, VecBase< U, 2 > yz, T w)
VecBase< T, 2 > xy() const
friend VecBase operator/(const VecBase &a, const VecBase &b)
VecBase< T, 3 > xyz() const
constexpr VecBase(T x, const VecBase< U, 2 > &yz)
friend VecBase operator+(const VecBase &a, const VecBase &b)
VecBase(T x, VecBase< U, 3 > yzw)
VecBase(T _x, T _y, T _z, T _w)
VecBase & operator+=(const VecBase &b) &
VecBase(const VecBase< U, Size > &vec)
T & operator[](int index)
VecBase(const T(*ptr)[Size])
friend VecBase operator-(const VecBase &a)
VecBase(T x, T y, VecBase< U, 2 > zw)
VecBase & operator/=(const VecBase &b) &
friend VecBase operator+(const T &a, const VecBase &b)
VecBase & operator/=(T b) &
friend VecBase operator+(const VecBase &a, const T &b)
friend VecBase operator*(T a, const VecBase &b)
VecBase(VecBase< U, 2 > xy, T z, T w)
VecBase & operator-=(const VecBase &b) &
VecBase & operator+=(const T &b) &
VecBase< T, 2 > yz() const
friend VecBase operator-(const VecBase &a, const T &b)
VecBase(VecBase< U, 3 > xyz, T w)
BLI_INT_OP(T) friend VecBase operator&(T a
VecBase(VecBase< U, 2 > xy, VecBase< V, 2 > zw)
VecBase & operator*=(const VecBase &b) &
VecBase & operator*=(T b) &
std::array< T, Size > values