Mercurial > libavutil.hg
comparison common.h @ 4:26a00aee5eac libavutil
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
where it makes more sense.
author | diego |
---|---|
date | Mon, 19 Sep 2005 23:26:47 +0000 |
parents | d4936ecaba90 |
children | 5ac9c20533c3 |
comparison
equal
deleted
inserted
replaced
3:d4936ecaba90 | 4:26a00aee5eac |
---|---|
541 perror("malloc");\ | 541 perror("malloc");\ |
542 goto fail;\ | 542 goto fail;\ |
543 }\ | 543 }\ |
544 } | 544 } |
545 | 545 |
546 #ifndef HAVE_LRINTF | |
547 /* XXX: add ISOC specific test to avoid specific BSD testing. */ | |
548 /* better than nothing implementation. */ | |
549 /* btw, rintf() is existing on fbsd too -- alex */ | |
550 static always_inline long int lrintf(float x) | |
551 { | |
552 #ifdef CONFIG_WIN32 | |
553 # ifdef ARCH_X86 | |
554 int32_t i; | |
555 asm volatile( | |
556 "fistpl %0\n\t" | |
557 : "=m" (i) : "t" (x) : "st" | |
558 ); | |
559 return i; | |
560 # else | |
561 /* XXX: incorrect, but make it compile */ | |
562 return (int)(x + (x < 0 ? -0.5 : 0.5)); | |
563 # endif /* ARCH_X86 */ | |
564 #else | |
565 return (int)(rint(x)); | |
566 #endif /* CONFIG_WIN32 */ | |
567 } | |
568 #else | |
569 #ifndef _ISOC9X_SOURCE | |
570 #define _ISOC9X_SOURCE | |
571 #endif | |
572 #include <math.h> | |
573 #endif /* HAVE_LRINTF */ | |
574 | |
546 #endif /* HAVE_AV_CONFIG_H */ | 575 #endif /* HAVE_AV_CONFIG_H */ |
547 | 576 |
548 #endif /* COMMON_H */ | 577 #endif /* COMMON_H */ |