From 17fd6fbe4e12f1ee5635ee05bb3072761ec7c334 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 8 Jun 2022 22:26:41 +0200 Subject: [PATCH] imlib: Optimize fmath ceilf and floorf functions. --- src/omv/imlib/fmath.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/omv/imlib/fmath.c b/src/omv/imlib/fmath.c index 151c8c2d5..fc387c1e0 100644 --- a/src/omv/imlib/fmath.c +++ b/src/omv/imlib/fmath.c @@ -62,7 +62,7 @@ int OMV_ATTR_ALWAYS_INLINE fast_floorf(float x) { int i; asm volatile ( - "vcvt.S32.f32 %[r], %[x]\n" + "vcvtm.S32.f32 %[r], %[x]\n" : [r] "=t" (i) : [x] "t" (x)); return i; @@ -71,9 +71,8 @@ int OMV_ATTR_ALWAYS_INLINE fast_floorf(float x) int OMV_ATTR_ALWAYS_INLINE fast_ceilf(float x) { int i; - x += 0.9999f; asm volatile ( - "vcvt.S32.f32 %[r], %[x]\n" + "vcvtp.S32.f32 %[r], %[x]\n" : [r] "=t" (i) : [x] "t" (x)); return i; @@ -83,7 +82,7 @@ int OMV_ATTR_ALWAYS_INLINE fast_roundf(float x) { int i; asm volatile ( - "vcvtr.s32.f32 %[r], %[x]\n" + "vcvtr.S32.F32 %[r], %[x]\n" : [r] "=t" (i) : [x] "t" (x)); return i;