aboutsummaryrefslogblamecommitdiffstats
path: root/libparsepcf_parse_int16_from_unsigned__.c
blob: 3d61ef8583dc37fdca7c9372dc31fb152248e2f1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                         
/* See LICENSE file for copyright and license details. */
#include "common.h"


int16_t
libparsepcf_parse_int16_from_unsigned__(uint16_t u)
{
	if (u & UINT16_C(0x8000)) {
		return (int16_t)(uint16_t)~u - 1;
	} else {
		return (int16_t)u;
	}
}