|
1 #ifndef __RESAMPLER_COMMON_DEFS_H__ |
|
2 #define __RESAMPLER_COMMON_DEFS_H__ |
|
3 /* |
|
4 * Copyright (c) 2010 Ixonos Plc. |
|
5 * All rights reserved. |
|
6 * This component and the accompanying materials are made available |
|
7 * under the terms of the "Eclipse Public License v1.0" |
|
8 * which accompanies this distribution, and is available |
|
9 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
10 * |
|
11 * Initial Contributors: |
|
12 * Nokia Corporation - Initial contribution |
|
13 * |
|
14 * Contributors: |
|
15 * Ixonos Plc |
|
16 * |
|
17 * Description: |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 /* Definitions for the FORCEINLINE macro. This is makes some of the |
|
24 * optimized versions far more easy to read. |
|
25 */ |
|
26 |
|
27 #if (!defined(__WINSCW__)) |
|
28 #define FORCEINLINE __forceinline |
|
29 |
|
30 #else |
|
31 #define FORCEINLINE inline |
|
32 |
|
33 #endif // __WINSCW__ |
|
34 |
|
35 /* Definitions for the packed struct. |
|
36 */ |
|
37 #if (!defined(__WINSCW__)) |
|
38 #undef PACKED_RVCT |
|
39 #define PACKED_RVCT __packed |
|
40 #undef PACKED_GCC |
|
41 #define PACKED_GCC |
|
42 |
|
43 #else |
|
44 #undef PACKED_RVCT |
|
45 #define PACKED_RVCT |
|
46 #undef PACKED_GCC |
|
47 #define PACKED_GCC |
|
48 |
|
49 #endif // __WINSCW__ |
|
50 |
|
51 /* Definitions for the min and max macros */ |
|
52 #define EAP_MAX(a, b) (((a)>=(b)) ? (a) : (b)) |
|
53 #define EAP_MIN(a, b) (((a)<(b)) ? (a) : (b)) |
|
54 |
|
55 #undef FLT_MAX |
|
56 #define FLT_MAX 3.40282347e+38F |
|
57 |
|
58 |
|
59 /* Handle stuff. */ |
|
60 |
|
61 /** Declare a handle type corresponding to type @c aType. |
|
62 * |
|
63 * For example, calling this macro with @c aType being @c X declares |
|
64 * handle type @c XHandle. */ |
|
65 /* Defining handle types this way is safer than just typedef'ing void |
|
66 * pointers, because the compiler is then able to catch more kinds of |
|
67 * handle misusage. */ |
|
68 #define DECLARE_HANDLE_TYPE(aType) \ |
|
69 struct aType##HandleTag { int m_dummy; }; \ |
|
70 typedef struct aType##HandleTag* aType##Handle |
|
71 |
|
72 /** @return A pointer to the instance of type @c aType, and associated |
|
73 * with @c aHandle. */ |
|
74 #define HANDLE_TO_PINST(aType, aHandle) ((aType*)aHandle) |
|
75 |
|
76 /** @return A handle associated with the pointer to the instance of type |
|
77 * @c aType. */ |
|
78 #define PINST_TO_HANDLE(aType, pInstance) ((aType##Handle)pInstance) |
|
79 |
|
80 #endif /* __RESAMPLER_COMMON_DEFS_H__ */ |