aboutsummaryrefslogtreecommitdiffstats
path: root/libparsepcf_parse_int16_from_unsigned__.c
blob: d4c0167606d2a8c8f71890ddd7d524e2e16cb678 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
/* 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;
}