mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 08:11:16 +00:00
031df7c737
Original commit message from CVS: Several solaris fixes, see #118473... One issue remaining (see the bug), so bug cannot be closed yet
35 lines
627 B
C
35 lines
627 B
C
/* fast int primitives. min,max,abs,samesign
|
|
*
|
|
* WARNING: Assumes 2's complement arithmetic.
|
|
*
|
|
*/
|
|
|
|
#ifndef __inline__
|
|
#define __inline__ inline
|
|
#endif
|
|
|
|
static __inline__ int intmax( register int x, register int y )
|
|
{
|
|
return x < y ? y : x;
|
|
}
|
|
|
|
static __inline__ int intmin( register int x, register int y )
|
|
{
|
|
return x < y ? x : y;
|
|
}
|
|
|
|
static __inline__ int intabs( register int x )
|
|
{
|
|
return x < 0 ? -x : x;
|
|
}
|
|
|
|
#define fabsshift ((8*sizeof(unsigned int))-1)
|
|
|
|
#define signmask(x) (((int)x)>>fabsshift)
|
|
static __inline__ int intsamesign(int x, int y)
|
|
{
|
|
return (y+(signmask(x) & -(y<<1)));
|
|
}
|
|
#undef signmask
|
|
#undef fabsshift
|
|
|