1 /*
2  * Musepack audio compression
3  * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; If not, see <http://www.gnu.org/licenses/>
17  */
18 
19 #pragma once
20 
21 # define clip(x,min,max) ( (x) < (min) ? (min) : (x) > (max) ? (max) : (x) )
22 
23 #ifdef __cplusplus
24 
25 # define maxi(A,B)  ( (A) >? (B) )
26 # define mini(A,B)  ( (A) <? (B) )
27 # define maxd(A,B)  ( (A) >? (B) )
28 # define mind(A,B)  ( (A) <? (B) )
29 # define maxf(A,B)  ( (A) >? (B) )
30 # define minf(A,B)  ( (A) <? (B) )
31 
32 #else
33 
34 # define maxi(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
35 # define mini(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
36 # define maxd(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
37 # define mind(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
38 # define maxf(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
39 # define minf(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
40 
41 #endif
42 
43 #ifdef __GNUC__
44 
45 # define absi(A)    abs   (A)
46 # define absf(A)    fabsf (A)
47 # define absd(A)    fabs  (A)
48 
49 #else
50 
51 # define absi(A)    ( (A) >= 0    ?  (A)  : -(A) )
52 # define absf(A)    ( (A) >= 0.f  ?  (A)  : -(A) )
53 # define absd(A)    ( (A) >= 0.   ?  (A)  : -(A) )
54 
55 #endif
56 
57