summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libmusepack/minimax.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libmusepack/minimax.h')
-rw-r--r--lib/rbcodec/codecs/libmusepack/minimax.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libmusepack/minimax.h b/lib/rbcodec/codecs/libmusepack/minimax.h
new file mode 100644
index 0000000000..1192626567
--- /dev/null
+++ b/lib/rbcodec/codecs/libmusepack/minimax.h
@@ -0,0 +1,57 @@
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, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#pragma once
21
22# define clip(x,min,max) ( (x) < (min) ? (min) : (x) > (max) ? (max) : (x) )
23
24#ifdef __cplusplus
25
26# define maxi(A,B) ( (A) >? (B) )
27# define mini(A,B) ( (A) <? (B) )
28# define maxd(A,B) ( (A) >? (B) )
29# define mind(A,B) ( (A) <? (B) )
30# define maxf(A,B) ( (A) >? (B) )
31# define minf(A,B) ( (A) <? (B) )
32
33#else
34
35# define maxi(A,B) ( (A) > (B) ? (A) : (B) )
36# define mini(A,B) ( (A) < (B) ? (A) : (B) )
37# define maxd(A,B) ( (A) > (B) ? (A) : (B) )
38# define mind(A,B) ( (A) < (B) ? (A) : (B) )
39# define maxf(A,B) ( (A) > (B) ? (A) : (B) )
40# define minf(A,B) ( (A) < (B) ? (A) : (B) )
41
42#endif
43
44#ifdef __GNUC__
45
46# define absi(A) abs (A)
47# define absf(A) fabsf (A)
48# define absd(A) fabs (A)
49
50#else
51
52# define absi(A) ( (A) >= 0 ? (A) : -(A) )
53# define absf(A) ( (A) >= 0.f ? (A) : -(A) )
54# define absd(A) ( (A) >= 0. ? (A) : -(A) )
55
56#endif
57