Skip to content

Commit 059640b

Browse files
neon64 implementation of ftoi
1 parent 7650c0a commit 059640b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

include/deadbeef/fastftoi.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,27 @@ static __inline void fpu_restore(fpu_control fpu){
157157

158158
#endif /* Special MSVC x64 implementation */
159159

160+
#if defined(__aarch64__)
161+
162+
# define FPU_CONTROL
163+
164+
#include <arm_neon.h>
165+
166+
typedef int16_t fpu_control;
167+
168+
static inline int ftoi(float f) {
169+
float32x2_t fvec = vld1_f32(&f);
170+
int32x2_t ivec = vcvt_s32_f32(fvec);
171+
return vget_lane_s32(ivec, 0);
172+
}
173+
174+
static inline void fpu_setround(fpu_control *fpu){
175+
}
176+
177+
static inline void fpu_restore(fpu_control fpu){
178+
}
179+
180+
#endif
160181

161182
/* If no special implementation was found for the current compiler / platform,
162183
use the default implementation here: */

0 commit comments

Comments
 (0)