Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skvx::ScaledDividerU32 Class Reference

#include <SkVx.h>

Public Member Functions

 ScaledDividerU32 (uint32_t divisor)
 
Vec< 4, uint32_t > divide (const Vec< 4, uint32_t > &numerator) const
 
uint32_t half () const
 

Detailed Description

Definition at line 879 of file SkVx.h.

Constructor & Destructor Documentation

◆ ScaledDividerU32()

skvx::ScaledDividerU32::ScaledDividerU32 ( uint32_t  divisor)
inlineexplicit

Definition at line 881 of file SkVx.h.

882 : fDivisorFactor{(uint32_t)(std::round((1.0 / divisor) * (1ull << 32)))}
883 , fHalf{(divisor + 1) >> 1} {
884 assert(divisor > 1);
885 }
static void round(SkPoint *p)

Member Function Documentation

◆ divide()

Vec< 4, uint32_t > skvx::ScaledDividerU32::divide ( const Vec< 4, uint32_t > &  numerator) const
inline

Definition at line 887 of file SkVx.h.

887 {
888#if SKVX_USE_SIMD && defined(SK_ARM_HAS_NEON)
889 uint64x2_t hi = vmull_n_u32(vget_high_u32(to_vext(numerator)), fDivisorFactor);
890 uint64x2_t lo = vmull_n_u32(vget_low_u32(to_vext(numerator)), fDivisorFactor);
891
892 return to_vec<4, uint32_t>(vcombine_u32(vshrn_n_u64(lo,32), vshrn_n_u64(hi,32)));
893#else
894 return cast<uint32_t>((cast<uint64_t>(numerator) * fDivisorFactor) >> 32);
895#endif
896 }

◆ half()

uint32_t skvx::ScaledDividerU32::half ( ) const
inline

Definition at line 898 of file SkVx.h.

898{ return fHalf; }

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