OLD | NEW |
1 /* Copyright (c) 2003-2008 Timothy B. Terriberry | 1 /* Copyright (c) 2003-2008 Timothy B. Terriberry |
2 Copyright (c) 2008 Xiph.Org Foundation */ | 2 Copyright (c) 2008 Xiph.Org Foundation */ |
3 /* | 3 /* |
4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
6 are met: | 6 are met: |
7 | 7 |
8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 */ | 26 */ |
27 | 27 |
28 /*Some common macros for potential platform-specific optimization.*/ | 28 /*Some common macros for potential platform-specific optimization.*/ |
29 #include "opus_types.h" | 29 #include "opus_types.h" |
30 #include <math.h> | 30 #include <math.h> |
31 #include <limits.h> | 31 #include <limits.h> |
32 #include "arch.h" | 32 #include "arch.h" |
33 #if !defined(_ecintrin_H) | 33 #if !defined(_ecintrin_H) |
34 # define _ecintrin_H (1) | 34 # define _ecintrin_H (1) |
35 | 35 |
36 /*Some specific platforms may have optimized intrinsic or inline assembly | 36 /*Some specific platforms may have optimized intrinsic or OPUS_INLINE assembly |
37 versions of these functions which can substantially improve performance. | 37 versions of these functions which can substantially improve performance. |
38 We define macros for them to allow easy incorporation of these non-ANSI | 38 We define macros for them to allow easy incorporation of these non-ANSI |
39 features.*/ | 39 features.*/ |
40 | 40 |
41 /*Modern gcc (4.x) can compile the naive versions of min and max with cmov if | 41 /*Modern gcc (4.x) can compile the naive versions of min and max with cmov if |
42 given an appropriate architecture, but the branchless bit-twiddling versions | 42 given an appropriate architecture, but the branchless bit-twiddling versions |
43 are just as fast, and do not require any special target architecture. | 43 are just as fast, and do not require any special target architecture. |
44 Earlier gcc versions (3.x) compiled both code to the same assembly | 44 Earlier gcc versions (3.x) compiled both code to the same assembly |
45 instructions, because of the way they represented ((_b)>(_a)) internally.*/ | 45 instructions, because of the way they represented ((_b)>(_a)) internally.*/ |
46 # define EC_MINI(_a,_b) ((_a)+(((_b)-(_a))&-((_b)<(_a)))) | 46 # define EC_MINI(_a,_b) ((_a)+(((_b)-(_a))&-((_b)<(_a)))) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 /*Note that __builtin_clz is not defined when _x==0, according to the gcc | 78 /*Note that __builtin_clz is not defined when _x==0, according to the gcc |
79 documentation (and that of the BSR instruction that implements it on x86). | 79 documentation (and that of the BSR instruction that implements it on x86). |
80 The majority of the time we can never pass it zero. | 80 The majority of the time we can never pass it zero. |
81 When we need to, it can be special cased.*/ | 81 When we need to, it can be special cased.*/ |
82 # define EC_ILOG(_x) (EC_CLZ0-EC_CLZ(_x)) | 82 # define EC_ILOG(_x) (EC_CLZ0-EC_CLZ(_x)) |
83 #else | 83 #else |
84 int ec_ilog(opus_uint32 _v); | 84 int ec_ilog(opus_uint32 _v); |
85 # define EC_ILOG(_x) (ec_ilog(_x)) | 85 # define EC_ILOG(_x) (ec_ilog(_x)) |
86 #endif | 86 #endif |
87 #endif | 87 #endif |
OLD | NEW |