beetle-psx-libretro/mednafen/clamp.h

26 lines
328 B
C
Raw Normal View History

2012-06-03 15:48:14 +00:00
#ifndef __MDFN_CLAMP_H
#define __MDFN_CLAMP_H
2015-07-29 22:07:56 +00:00
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#ifndef _WIN32
#include <unistd.h>
#endif
2015-07-25 23:52:13 +00:00
static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max)
2012-06-03 15:48:14 +00:00
{
2015-07-25 23:52:13 +00:00
if(*val < min)
*val = min;
if(*val > max)
*val = max;
2012-06-03 15:48:14 +00:00
}
2015-07-29 22:07:56 +00:00
#ifdef __cplusplus
}
#endif
2012-06-03 15:48:14 +00:00
#endif