diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2002-10-24 22:37:51 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2002-10-24 22:37:51 +0000 |
commit | 1496394c0f4be1a718fb189846c6350cbd9e43da (patch) | |
tree | 7f839063fd206ad3db102a7a20c336d0c8423295 /ext/mplex/fastintfns.h | |
parent | 440801dd9e53284925575c2170b53bf947522414 (diff) | |
download | gst-plugins-bad-1496394c0f4be1a718fb189846c6350cbd9e43da.tar.gz gst-plugins-bad-1496394c0f4be1a718fb189846c6350cbd9e43da.tar.bz2 gst-plugins-bad-1496394c0f4be1a718fb189846c6350cbd9e43da.zip |
First stab at porting mplex
Original commit message from CVS:
First stab at porting mplex
Diffstat (limited to 'ext/mplex/fastintfns.h')
-rw-r--r-- | ext/mplex/fastintfns.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/mplex/fastintfns.h b/ext/mplex/fastintfns.h new file mode 100644 index 00000000..db78af1e --- /dev/null +++ b/ext/mplex/fastintfns.h @@ -0,0 +1,32 @@ +/* fast int primitives. min,max,abs,samesign + * + * WARNING: Assumes 2's complement arithmetic. + * + */ + + +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 + |