public static function bytesToSShort($bytes, $offset, $endian)
    {
        $n = self::bytesToShort($bytes, $offset, $endian);
        if ($n > 32767) {
            return $n - 65536;
        } else {
            return $n;
        }
    }