This commit is contained in:
twinaphex 2016-06-07 04:59:17 +02:00
parent f3cc4effcc
commit 1b9a6944b3

View File

@ -10,23 +10,6 @@ extern "C" {
#include <unistd.h> #include <unistd.h>
#endif #endif
static INLINE int32 clamp_to_u8(int32 i)
{
if(i & 0xFFFFFF00)
i = (((~i) >> 30) & 0xFF);
return(i);
}
static INLINE int32 clamp_to_u16(int32 i)
{
if(i & 0xFFFF0000)
i = (((~i) >> 31) & 0xFFFF);
return(i);
}
static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max) static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max)
{ {
if(*val < min) if(*val < min)
@ -35,10 +18,6 @@ static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max)
*val = max; *val = max;
} }
#define clamp_simple(val) \
if ( (int16_t)val != val ) \
val = (val >> 31) ^ 0x7FFF;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif