Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
skvx::Vec< 2, T > Struct Template Reference

#include <SkVx.h>

Public Member Functions

SKVX_ALWAYS_INLINE Vec ()=default
 
SKVX_ALWAYS_INLINE Vec (T s)
 
SKVX_ALWAYS_INLINE Vec (T x, T y)
 
SKVX_ALWAYS_INLINE Vec (std::initializer_list< T > xs)
 
SKVX_ALWAYS_INLINE T operator[] (int i) const
 
SKVX_ALWAYS_INLINE Toperator[] (int i)
 
SKVX_ALWAYS_INLINE void store (void *ptr) const
 
SKVX_ALWAYS_INLINE Tx ()
 
SKVX_ALWAYS_INLINE Ty ()
 
SKVX_ALWAYS_INLINE T x () const
 
SKVX_ALWAYS_INLINE T y () const
 
SKVX_ALWAYS_INLINE Vec< 2, Tyx () const
 
SKVX_ALWAYS_INLINE Vec< 4, Txyxy () const
 

Static Public Member Functions

static SKVX_ALWAYS_INLINE Vec Load (const void *ptr)
 

Public Attributes

Vec< 1, Tlo
 
Vec< 1, Thi
 

Detailed Description

template<typename T>
struct skvx::Vec< 2, T >

Definition at line 174 of file SkVx.h.

Constructor & Destructor Documentation

◆ Vec() [1/4]

template<typename T >
SKVX_ALWAYS_INLINE skvx::Vec< 2, T >::Vec ( )
default

◆ Vec() [2/4]

template<typename T >
SKVX_ALWAYS_INLINE skvx::Vec< 2, T >::Vec ( T  s)
inline

Definition at line 178 of file SkVx.h.

178: lo(s), hi(s) {}
struct MyStruct s
Vec< 1, T > lo
Definition SkVx.h:210
Vec< 1, T > hi
Definition SkVx.h:210

◆ Vec() [3/4]

template<typename T >
SKVX_ALWAYS_INLINE skvx::Vec< 2, T >::Vec ( T  x,
T  y 
)
inline

Definition at line 179 of file SkVx.h.

179: lo(x), hi(y) {}
SKVX_ALWAYS_INLINE T & x()
Definition SkVx.h:200
SKVX_ALWAYS_INLINE T & y()
Definition SkVx.h:201

◆ Vec() [4/4]

template<typename T >
SKVX_ALWAYS_INLINE skvx::Vec< 2, T >::Vec ( std::initializer_list< T xs)
inline

Definition at line 181 of file SkVx.h.

181 {
182 T vals[2] = {0};
183 assert(xs.size() <= (size_t)2);
184 memcpy(vals, xs.begin(), std::min(xs.size(), (size_t)2)*sizeof(T));
185
186 this->lo = Vec<1,T>::Load(vals + 0);
187 this->hi = Vec<1,T>::Load(vals + 1);
188 }
#define T
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)
Definition SkVx.h:109

Member Function Documentation

◆ Load()

template<typename T >
static SKVX_ALWAYS_INLINE Vec skvx::Vec< 2, T >::Load ( const void *  ptr)
inlinestatic

Definition at line 193 of file SkVx.h.

193 {
194 return sk_unaligned_load<Vec>(ptr);
195 }

◆ operator[]() [1/2]

template<typename T >
SKVX_ALWAYS_INLINE T & skvx::Vec< 2, T >::operator[] ( int  i)
inline

Definition at line 191 of file SkVx.h.

191{ return i<1 ? this->lo[i] : this->hi[i-1]; }

◆ operator[]() [2/2]

template<typename T >
SKVX_ALWAYS_INLINE T skvx::Vec< 2, T >::operator[] ( int  i) const
inline

Definition at line 190 of file SkVx.h.

190{ return i<1 ? this->lo[i] : this->hi[i-1]; }

◆ store()

template<typename T >
SKVX_ALWAYS_INLINE void skvx::Vec< 2, T >::store ( void *  ptr) const
inline

Definition at line 196 of file SkVx.h.

196 {
197 memcpy(ptr, this, sizeof(Vec));
198 }
SKVX_ALWAYS_INLINE Vec()=default

◆ x() [1/2]

template<typename T >
SKVX_ALWAYS_INLINE T & skvx::Vec< 2, T >::x ( )
inline

Definition at line 200 of file SkVx.h.

200{ return lo.val; }

◆ x() [2/2]

template<typename T >
SKVX_ALWAYS_INLINE T skvx::Vec< 2, T >::x ( ) const
inline

Definition at line 203 of file SkVx.h.

203{ return lo.val; }

◆ xyxy()

template<typename T >
SKVX_ALWAYS_INLINE Vec< 4, T > skvx::Vec< 2, T >::xyxy ( ) const
inline

Definition at line 208 of file SkVx.h.

208{ return Vec<4,T>(*this, *this); }

◆ y() [1/2]

template<typename T >
SKVX_ALWAYS_INLINE T & skvx::Vec< 2, T >::y ( )
inline

Definition at line 201 of file SkVx.h.

201{ return hi.val; }

◆ y() [2/2]

template<typename T >
SKVX_ALWAYS_INLINE T skvx::Vec< 2, T >::y ( ) const
inline

Definition at line 204 of file SkVx.h.

204{ return hi.val; }

◆ yx()

template<typename T >
SKVX_ALWAYS_INLINE Vec< 2, T > skvx::Vec< 2, T >::yx ( ) const
inline

Definition at line 207 of file SkVx.h.

207{ return shuffle<1,0>(*this); }

Member Data Documentation

◆ hi

template<typename T >
Vec<1,T> skvx::Vec< 2, T >::hi

Definition at line 210 of file SkVx.h.

◆ lo

template<typename T >
Vec<1,T> skvx::Vec< 2, T >::lo

Definition at line 210 of file SkVx.h.


The documentation for this struct was generated from the following file: