1 /***************************************************************************
2                          externals.c  -  description
3                              -------------------
4     begin                : Wed May 15 2002
5     copyright            : (C) 2002 by Pete Bernert
6     email                : BlackDove@addcom.de
7  ***************************************************************************/
8 /***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version. See also the license.txt file for *
14  *   additional informations.                                              *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #include <stdint.h>
19 
20 // 15-bit value + 1-sign
CLAMP16(int x)21 int CLAMP16(int x) {
22 	if(x > 32767) x = 32767;
23 	else if(x < -32768) x = -32768;
24 
25 	return x;
26 }
27