annotate libm.h @ 878:1380f7caffd6 libavutil

Add missing parentheses around the AVERROR_PATCHWELCOME macro definition.
author stefano
date Sat, 13 Mar 2010 09:52:43 +0000
parents 9d32a031ab0b
children 0795a743bda1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
871
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
1 /*
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
2 * This file is part of FFmpeg.
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
3 *
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
4 * FFmpeg is free software; you can redistribute it and/or
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
8 *
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
9 * FFmpeg is distributed in the hope that it will be useful,
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
12 * Lesser General Public License for more details.
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
13 *
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
15 * License along with FFmpeg; if not, write to the Free Software
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
17 */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
18
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
19 /**
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
20 * @file libavutil/libm.h
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
21 * Replacements for frequently missing libm functions
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
22 */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
23
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
24 #ifndef AVUTIL_LIBM_H
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
25 #define AVUTIL_LIBM_H
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
26
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
27 #include <math.h>
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
28 #include "config.h"
872
9d32a031ab0b libm.h needs attributes.h
mru
parents: 871
diff changeset
29 #include "attributes.h"
871
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
30
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
31 #if !HAVE_EXP2
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
32 #undef exp2
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
33 #define exp2(x) exp((x) * 0.693147180559945)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
34 #endif /* HAVE_EXP2 */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
35
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
36 #if !HAVE_EXP2F
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
37 #undef exp2f
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
38 #define exp2f(x) ((float)exp2(x))
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
39 #endif /* HAVE_EXP2F */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
40
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
41 #if !HAVE_LLRINT
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
42 #undef llrint
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
43 #define llrint(x) ((long long)rint(x))
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
44 #endif /* HAVE_LLRINT */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
45
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
46 #if !HAVE_LOG2
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
47 #undef log2
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
48 #define log2(x) (log(x) * 1.44269504088896340736)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
49 #endif /* HAVE_LOG2 */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
50
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
51 #if !HAVE_LOG2F
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
52 #undef log2f
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
53 #define log2f(x) ((float)log2(x))
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
54 #endif /* HAVE_LOG2F */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
55
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
56 #if !HAVE_LRINT
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
57 static av_always_inline av_const long int lrint(double x)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
58 {
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
59 return rint(x);
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
60 }
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
61 #endif /* HAVE_LRINT */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
62
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
63 #if !HAVE_LRINTF
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
64 static av_always_inline av_const long int lrintf(float x)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
65 {
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
66 return (int)(rint(x));
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
67 }
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
68 #endif /* HAVE_LRINTF */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
69
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
70 #if !HAVE_ROUND
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
71 static av_always_inline av_const double round(double x)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
72 {
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
73 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
74 }
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
75 #endif /* HAVE_ROUND */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
76
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
77 #if !HAVE_ROUNDF
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
78 static av_always_inline av_const float roundf(float x)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
79 {
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
80 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
81 }
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
82 #endif /* HAVE_ROUNDF */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
83
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
84 #if !HAVE_TRUNCF
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
85 static av_always_inline av_const float truncf(float x)
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
86 {
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
87 return (x > 0) ? floor(x) : ceil(x);
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
88 }
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
89 #endif /* HAVE_TRUNCF */
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
90
0d85cdd07648 Move libm replacements to new header libm.h
mru
parents:
diff changeset
91 #endif /* AVUTIL_LIBM_H */