Index: src/opts/SkNx_neon.h |
diff --git a/src/opts/SkNx_neon.h b/src/opts/SkNx_neon.h |
index bb81cded187ff9c1995d6230d43b000d8ca733ae..701b7326ee16d600fa71da5cee3faeca421bf824 100644 |
--- a/src/opts/SkNx_neon.h |
+++ b/src/opts/SkNx_neon.h |
@@ -450,4 +450,13 @@ template<> inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) { |
return vmovn_u16(vcombine_u16(src.fVec, src.fVec)); |
} |
+static inline Sk4i Sk4f_RoundToInt(const Sk4f& x) { |
+ return vcvtq_s32_f32((x + 0.5f).fVec); |
+} |
+ |
+static inline uint32_t Sk4f_RoundToByte(const Sk4f& x) { |
+ uint16x4_t x16 = vqmovun_s32(Sk4f_RoundToInt(x.fVec).fVec); |
+ return vget_lane_u32(vreinterpret_u32_u8(vqmovn_u16(vcombine_u16(x16, x16))), 0); |
+} |
+ |
#endif//SkNx_neon_DEFINED |