Jean-Marc Valin | 72e8003 | 2008-03-12 10:16:26 +1100 | [diff] [blame] | 1 | /* Copyright (C) 2003 Jean-Marc Valin */ |
| 2 | /** |
| 3 | @file fixed_c5x.h |
| 4 | @brief Fixed-point operations for the TI C5x DSP family |
| 5 | */ |
| 6 | /* |
| 7 | Redistribution and use in source and binary forms, with or without |
| 8 | modification, are permitted provided that the following conditions |
| 9 | are met: |
| 10 | |
| 11 | - Redistributions of source code must retain the above copyright |
| 12 | notice, this list of conditions and the following disclaimer. |
| 13 | |
| 14 | - Redistributions in binary form must reproduce the above copyright |
| 15 | notice, this list of conditions and the following disclaimer in the |
| 16 | documentation and/or other materials provided with the distribution. |
| 17 | |
| 18 | - Neither the name of the Xiph.org Foundation nor the names of its |
| 19 | contributors may be used to endorse or promote products derived from |
| 20 | this software without specific prior written permission. |
| 21 | |
| 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 | */ |
| 34 | |
| 35 | #ifndef FIXED_C5X_H |
| 36 | #define FIXED_C5X_H |
| 37 | |
Jean-Marc Valin | 72e8003 | 2008-03-12 10:16:26 +1100 | [diff] [blame] | 38 | #undef MAX16 |
| 39 | #define MAX16(a,b) _max(a,b) |
| 40 | |
| 41 | #undef MIN16 |
| 42 | #define MIN16(a,b) _min(a,b) |
| 43 | |
| 44 | #undef MAX32 |
| 45 | #define MAX32(a,b) _lmax(a,b) |
| 46 | |
| 47 | #undef MIN32 |
| 48 | #define MIN32(a,b) _lmin(a,b) |
| 49 | |
| 50 | #undef VSHR32 |
| 51 | #define VSHR32(a, shift) _lshl(a,-(shift)) |
Jean-Marc Valin | 72e8003 | 2008-03-12 10:16:26 +1100 | [diff] [blame] | 52 | |
Jean-Marc Valin | bfcbd18 | 2008-03-15 08:12:49 +1100 | [diff] [blame] | 53 | #undef MULT16_16_Q15 |
| 54 | #define MULT16_16_Q15(a,b) (_smpy(a,b)) |
| 55 | |
Jean-Marc Valin | b311554 | 2008-03-16 23:33:02 +1100 | [diff] [blame^] | 56 | #undef MULT16_16SU |
| 57 | #define MULT16_16SU(a,b) _lmpysu(a,b) |
| 58 | |
| 59 | #undef MULT_16_16 |
| 60 | #define MULT_16_16(a,b) _lmpy(a,b) |
Jean-Marc Valin | bfcbd18 | 2008-03-15 08:12:49 +1100 | [diff] [blame] | 61 | |
| 62 | #endif /* FIXED_C5X_H */ |