Mercurial > libavutil.hg
annotate integer.h @ 822:a1680eca3e52 libavutil
DECLARE_ALIGNED macro for TMS470 compiler
This compiler supports gcc-style alignment attributes for struct,
but not for global variables. For the latter, alignment can be
specified with a pragma, which does not work for struct members or
local variables. By using both pragma and attribute, one or the
other will always take effect.
Unfortunately, no means exists for aligning stack variables.
author | mru |
---|---|
date | Fri, 22 Jan 2010 03:25:25 +0000 |
parents | 70bdd5501662 |
children | 0795a743bda1 |
rev | line source |
---|---|
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
1 /* |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
2 * arbitrary precision integers |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
4 * |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
15
diff
changeset
|
5 * This file is part of FFmpeg. |
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
15
diff
changeset
|
6 * |
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
15
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
15
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
11 * |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
15
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
16 * |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
15
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
15
af59e84e283d
Update licensing information: The FSF changed postal address.
diego
parents:
12
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
20 */ |
12 | 21 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
22 /** |
642
70bdd5501662
Use full internal pathname in doxygen @file directives.
diego
parents:
637
diff
changeset
|
23 * @file libavutil/integer.h |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
24 * arbitrary precision integers |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
25 * @author Michael Niedermayer <michaelni@gmx.at> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
26 */ |
12 | 27 |
567 | 28 #ifndef AVUTIL_INTEGER_H |
29 #define AVUTIL_INTEGER_H | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
30 |
343 | 31 #include <stdint.h> |
485 | 32 #include "common.h" |
343 | 33 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
34 #define AV_INTEGER_SIZE 8 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
35 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
36 typedef struct AVInteger{ |
12 | 37 uint16_t v[AV_INTEGER_SIZE]; |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
38 } AVInteger; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
39 |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
40 AVInteger av_add_i(AVInteger a, AVInteger b) av_const; |
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
41 AVInteger av_sub_i(AVInteger a, AVInteger b) av_const; |
277
d25ab70c93c4
Move av_log2_i()'s unaltered comments to the header file.
takis
parents:
276
diff
changeset
|
42 |
d25ab70c93c4
Move av_log2_i()'s unaltered comments to the header file.
takis
parents:
276
diff
changeset
|
43 /** |
637 | 44 * Returns the rounded-down value of the base 2 logarithm of the given |
45 * AVInteger. This is simply the index of the most significant bit | |
46 * which is 1, or 0 if all bits are 0. | |
277
d25ab70c93c4
Move av_log2_i()'s unaltered comments to the header file.
takis
parents:
276
diff
changeset
|
47 */ |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
48 int av_log2_i(AVInteger a) av_const; |
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
49 AVInteger av_mul_i(AVInteger a, AVInteger b) av_const; |
274
57262361a75c
Move av_cmp_i()'s unaltered comment to the header file.
takis
parents:
273
diff
changeset
|
50 |
57262361a75c
Move av_cmp_i()'s unaltered comment to the header file.
takis
parents:
273
diff
changeset
|
51 /** |
633 | 52 * Returns 0 if a==b, 1 if a>b and -1 if a<b. |
274
57262361a75c
Move av_cmp_i()'s unaltered comment to the header file.
takis
parents:
273
diff
changeset
|
53 */ |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
54 int av_cmp_i(AVInteger a, AVInteger b) av_const; |
273
1907c66098b0
Move av_shr_i()'s unaltered comments to the header file.
takis
parents:
272
diff
changeset
|
55 |
1907c66098b0
Move av_shr_i()'s unaltered comments to the header file.
takis
parents:
272
diff
changeset
|
56 /** |
633 | 57 * bitwise shift |
58 * @param s the number of bits by which the value should be shifted right, | |
59 may be negative for shifting left | |
273
1907c66098b0
Move av_shr_i()'s unaltered comments to the header file.
takis
parents:
272
diff
changeset
|
60 */ |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
61 AVInteger av_shr_i(AVInteger a, int s) av_const; |
271
38e9c99c3aad
Move av_mod_i()'s comment to the header file. The moved comment is unmodified.
takis
parents:
116
diff
changeset
|
62 |
38e9c99c3aad
Move av_mod_i()'s comment to the header file. The moved comment is unmodified.
takis
parents:
116
diff
changeset
|
63 /** |
633 | 64 * Returns a % b. |
65 * @param quot a/b will be stored here. | |
271
38e9c99c3aad
Move av_mod_i()'s comment to the header file. The moved comment is unmodified.
takis
parents:
116
diff
changeset
|
66 */ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
67 AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b); |
272
2bf3b2fee71a
Move av_div_i()'s comments to the header file. The comments are unaltered.
takis
parents:
271
diff
changeset
|
68 |
2bf3b2fee71a
Move av_div_i()'s comments to the header file. The comments are unaltered.
takis
parents:
271
diff
changeset
|
69 /** |
633 | 70 * Returns a/b. |
272
2bf3b2fee71a
Move av_div_i()'s comments to the header file. The comments are unaltered.
takis
parents:
271
diff
changeset
|
71 */ |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
72 AVInteger av_div_i(AVInteger a, AVInteger b) av_const; |
275
14164ec1b454
Move av_int2i()'s unaltered comments to the header file.
takis
parents:
274
diff
changeset
|
73 |
14164ec1b454
Move av_int2i()'s unaltered comments to the header file.
takis
parents:
274
diff
changeset
|
74 /** |
633 | 75 * Converts the given int64_t to an AVInteger. |
275
14164ec1b454
Move av_int2i()'s unaltered comments to the header file.
takis
parents:
274
diff
changeset
|
76 */ |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
77 AVInteger av_int2i(int64_t a) av_const; |
276
0df0d9771d02
Move av_i2int()'s unaltered comments to the header file.
takis
parents:
275
diff
changeset
|
78 |
0df0d9771d02
Move av_i2int()'s unaltered comments to the header file.
takis
parents:
275
diff
changeset
|
79 /** |
636 | 80 * Converts the given AVInteger to an int64_t. |
81 * If the AVInteger is too large to fit into an int64_t, | |
82 * then only the least significant 64 bits will be used. | |
276
0df0d9771d02
Move av_i2int()'s unaltered comments to the header file.
takis
parents:
275
diff
changeset
|
83 */ |
481
f4187c1c15a6
Reapply r12489: Add pure, const and malloc attributes to proper functions
zuxy
parents:
478
diff
changeset
|
84 int64_t av_i2int(AVInteger a) av_const; |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
85 |
567 | 86 #endif /* AVUTIL_INTEGER_H */ |