summaryrefslogtreecommitdiff
path: root/plugins/dfsound/externals.c
blob: 6ca90a13df658a7c4cb6c6e38692119762fddb07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/***************************************************************************
                         externals.c  -  description
                             -------------------
    begin                : Wed May 15 2002
    copyright            : (C) 2002 by Pete Bernert
    email                : BlackDove@addcom.de
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version. See also the license.txt file for *
 *   additional informations.                                              *
 *                                                                         *
 ***************************************************************************/

#include <stdint.h>

// 15-bit value + 1-sign
int CLAMP16(int x) {
	if(x > 32767) x = 32767;
	else if(x < -32768) x = -32768;

	return x;
}