mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Make the SF_MIN and SF_MAX macros at least partially type safe.
This commit is contained in:
parent
b51bab566c
commit
2b06fbb022
@ -1,3 +1,8 @@
|
||||
2006-09-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/common.h
|
||||
Make the SF_MIN and SF_MAX macros at least partially type safe.
|
||||
|
||||
2006-08-31 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* configure.ac docs/*.html
|
||||
|
14
src/common.h
14
src/common.h
@ -72,8 +72,22 @@
|
||||
|
||||
#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0])))
|
||||
|
||||
#if (COMPILER_IS_GCC == 1)
|
||||
#define SF_MAX(x,y) ({ \
|
||||
typeof(x) _x = (x); \
|
||||
typeof(y) _y = (y); \
|
||||
(void) (&_x == &_y); \
|
||||
_x > _y ? _x : _y; })
|
||||
|
||||
#define SF_MIN(x,y) ({ \
|
||||
typeof(x) _x = (x); \
|
||||
typeof(y) _y = (y); \
|
||||
(void) (&_x == &_y); \
|
||||
_x < _y ? _x : _y; })
|
||||
#else
|
||||
#define SF_MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define SF_MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
enum
|
||||
{ /* PEAK chunk location. */
|
||||
|
Loading…
Reference in New Issue
Block a user