50 BLI_STATIC_ASSERT(T::type_length <= 4,
"Longer types need to implement vector_hash themself.");
51 const typename T::uint_type &uvec = *
reinterpret_cast<const typename T::uint_type *
>(&vec);
54 if constexpr (T::type_length > 1) {
55 result ^= uvec[1] *
uint64_t(380867);
57 if constexpr (T::type_length > 2) {
58 result ^= uvec[2] *
uint64_t(1059217);
60 if constexpr (T::type_length > 3) {
61 result ^= uvec[3] *
uint64_t(2002613);
71 "VecBase is not compatible with aligned type for now.");
74#define BLI_ENABLE_IF_VEC(_size, _test) int S = _size, BLI_ENABLE_IF((S _test))
83 template<BLI_ENABLE_IF_VEC(Size, > 1)>
explicit VecBase(T value)
85 for (
int i = 0; i < Size; i++) {
90 template<
typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))>
95 template<BLI_ENABLE_IF_VEC(Size, == 1)>
VecBase(T _x)
100 template<BLI_ENABLE_IF_VEC(Size, == 2)>
VecBase(T _x, T _y)
106 template<BLI_ENABLE_IF_VEC(Size, == 3)>
VecBase(T _x, T _y, T _z)
113 template<BLI_ENABLE_IF_VEC(Size, == 4)>
VecBase(T _x, T _y, T _z, T _w)
123 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 3)>
128 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 3)>
133 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
138 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
143 template<
typename U,
typename V, BLI_ENABLE_IF_VEC(Size, == 4)>
148 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
153 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
158 template<
typename U, BLI_ENABLE_IF_VEC(Size, == 4)>
165 template<
typename U,
int OtherSize, BLI_ENABLE_IF(OtherSize > Size)>
168 for (
int i = 0; i < Size; i++) {
169 (*this)[i] =
T(other[i]);
182 return *
reinterpret_cast<const VecBase<T, 2> *
>(&((*this)[1]));
187 return *
reinterpret_cast<const VecBase<T, 2> *
>(&((*this)[2]));
197 return *
reinterpret_cast<const VecBase<T, 3> *
>(&((*this)[1]));
205#undef BLI_ENABLE_IF_VEC
213# pragma GCC diagnostic push
214# pragma GCC diagnostic ignored "-Warray-bounds"
222 template<
typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))>
explicit VecBase(
const U *
ptr)
230# pragma GCC diagnostic pop
242 operator const T *()
const
244 return reinterpret_cast<const T *
>(
this);
249 return reinterpret_cast<T *
>(
this);
258 return reinterpret_cast<const T *
>(
this)[index];
265 return reinterpret_cast<T *
>(
this)[index];
270#define BLI_INT_OP(_T) template<typename U = _T, BLI_ENABLE_IF((std::is_integral_v<U>))>
356 for (
int i = 0; i < Size; i++) {
370 for (
int i = 0; i < Size; i++) {
384 for (
int i = 0; i < Size; i++) {
518 for (
int i = 0; i < Size; i++) {
532 for (
int i = 0; i < Size; i++) {
544 for (
int i = 0; i < Size; i++) {
567 for (
int i = 0; i < Size; i++) {
582 static constexpr T value =
T(0.0002);
#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
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 const float4 operator^(const float4 a, const float4 b)
ccl_device_inline int4 operator>>(const int4 a, 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)
ccl_device_inline int4 operator&(const int4 a, const int4 b)
GPUState operator~(const GPUState &a)
uint64_t vector_hash(const T &vec)
constexpr bool operator!=(StringRef a, StringRef b)
constexpr bool operator==(StringRef a, StringRef b)
std::ostream & operator<<(std::ostream &stream, const eAlpha &space)
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
unsigned __int64 uint64_t
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)
VecBase & operator+=(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*=(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 & operator/=(const VecBase &b)
VecBase & operator-=(const VecBase &b)
VecBase & operator/=(T b)
VecBase(T _x, T _y, T _z, T _w)
VecBase & operator+=(const T &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)
friend VecBase operator+(const T &a, const VecBase &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< 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 T &b)
std::array< T, Size > values