minimax.h

00001 /*
00002  * Musepack audio compression
00003  * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #pragma once
00021 
00022 # define clip(x,min,max) ( (x) < (min) ? (min) : (x) > (max) ? (max) : (x) )
00023 
00024 #ifdef __cplusplus
00025 
00026 # define maxi(A,B)  ( (A) >? (B) )
00027 # define mini(A,B)  ( (A) <? (B) )
00028 # define maxd(A,B)  ( (A) >? (B) )
00029 # define mind(A,B)  ( (A) <? (B) )
00030 # define maxf(A,B)  ( (A) >? (B) )
00031 # define minf(A,B)  ( (A) <? (B) )
00032 
00033 #else
00034 
00035 # define maxi(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
00036 # define mini(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
00037 # define maxd(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
00038 # define mind(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
00039 # define maxf(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
00040 # define minf(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
00041 
00042 #endif
00043 
00044 #ifdef __GNUC__
00045 
00046 # define absi(A)    abs   (A)
00047 # define absf(A)    fabsf (A)
00048 # define absd(A)    fabs  (A)
00049 
00050 #else
00051 
00052 # define absi(A)    ( (A) >= 0    ?  (A)  : -(A) )
00053 # define absf(A)    ( (A) >= 0.f  ?  (A)  : -(A) )
00054 # define absd(A)    ( (A) >= 0.   ?  (A)  : -(A) )
00055 
00056 #endif
00057 

Generated on 20 Jan 2011 for libmpcdec by  doxygen 1.6.1