Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
skvx::Vec< N, 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 (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
 

Static Public Member Functions

static SKVX_ALWAYS_INLINE Vec Load (const void *ptr)
 

Public Attributes

Vec< N/2, Tlo
 
Vec< N/2, Thi
 

Detailed Description

template<int N, typename T>
struct skvx::Vec< N, T >

Definition at line 83 of file SkVx.h.

Constructor & Destructor Documentation

◆ Vec() [1/3]

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

◆ Vec() [2/3]

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

Definition at line 93 of file SkVx.h.

93: lo(s), hi(s) {}
struct MyStruct s
Vec< N/2, T > hi
Definition SkVx.h:117
Vec< N/2, T > lo
Definition SkVx.h:117

◆ Vec() [3/3]

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

Definition at line 97 of file SkVx.h.

97 {
98 T vals[N] = {0};
99 assert(xs.size() <= (size_t)N);
100 memcpy(vals, xs.begin(), std::min(xs.size(), (size_t)N)*sizeof(T));
101
102 this->lo = Vec<N/2,T>::Load(vals + 0);
103 this->hi = Vec<N/2,T>::Load(vals + N/2);
104 }
#define N
Definition beziers.cpp:19
#define T
SKVX_ALWAYS_INLINE Vec()=default
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)
Definition SkVx.h:109

Member Function Documentation

◆ Load()

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

Definition at line 109 of file SkVx.h.

109 {
110 return sk_unaligned_load<Vec>(ptr);
111 }

◆ operator[]() [1/2]

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

Definition at line 107 of file SkVx.h.

107{ return i<N/2 ? this->lo[i] : this->hi[i-N/2]; }

◆ operator[]() [2/2]

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

Definition at line 106 of file SkVx.h.

106{ return i<N/2 ? this->lo[i] : this->hi[i-N/2]; }

◆ store()

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

Definition at line 112 of file SkVx.h.

112 {
113 // Note: Calling sk_unaligned_store produces slightly worse code here, for some reason
114 memcpy(ptr, this, sizeof(Vec));
115 }

Member Data Documentation

◆ hi

template<int N, typename T >
Vec<N/2,T> skvx::Vec< N, T >::hi

Definition at line 117 of file SkVx.h.

◆ lo

template<int N, typename T >
Vec<N/2,T> skvx::Vec< N, T >::lo

Definition at line 117 of file SkVx.h.


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