beetle-psx-libretro/mednafen/clamp.h
2016-06-07 04:59:17 +02:00

26 lines
328 B
C

#ifndef __MDFN_CLAMP_H
#define __MDFN_CLAMP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#ifndef _WIN32
#include <unistd.h>
#endif
static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max)
{
if(*val < min)
*val = min;
if(*val > max)
*val = max;
}
#ifdef __cplusplus
}
#endif
#endif