Mercurial > libavcodec.hg
comparison dsputil.h @ 2185:784c38a3ffc2 libavcodec
lrintf emulation improvments
author | michael |
---|---|
date | Tue, 24 Aug 2004 16:33:55 +0000 |
parents | 3378d0677903 |
children | 7e0b2e86afa9 |
comparison
equal
deleted
inserted
replaced
2184:3378d0677903 | 2185:784c38a3ffc2 |
---|---|
581 | 581 |
582 #ifndef HAVE_LRINTF | 582 #ifndef HAVE_LRINTF |
583 /* XXX: add ISOC specific test to avoid specific BSD testing. */ | 583 /* XXX: add ISOC specific test to avoid specific BSD testing. */ |
584 /* better than nothing implementation. */ | 584 /* better than nothing implementation. */ |
585 /* btw, rintf() is existing on fbsd too -- alex */ | 585 /* btw, rintf() is existing on fbsd too -- alex */ |
586 static inline long int lrintf(float x) | 586 static always_inline long int lrintf(float x) |
587 { | 587 { |
588 #ifdef CONFIG_WIN32 | 588 #ifdef CONFIG_WIN32 |
589 # ifdef ARCH_X86 | |
590 int32_t i; | |
591 asm volatile( | |
592 "fistpl %0\n\t" | |
593 : "=m" (i) : "t" (x) : "st" | |
594 ); | |
595 return i; | |
596 # else | |
589 /* XXX: incorrect, but make it compile */ | 597 /* XXX: incorrect, but make it compile */ |
590 return (int)(x); | 598 return (int)(x + (x < 0 ? -0.5 : 0.5)); |
599 # endif | |
591 #else | 600 #else |
592 return (int)(rint(x)); | 601 return (int)(rint(x)); |
593 #endif | 602 #endif |
594 } | 603 } |
595 #else | 604 #else |