1/* -*- C++ -*-
2 SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#ifndef nsPkgInt_h__
8#define nsPkgInt_h__
9
10namespace kencodingprober
11{
12typedef enum {
13 eIdxSft4bits = 3,
14 eIdxSft8bits = 2,
15 eIdxSft16bits = 1,
16} nsIdxSft;
17
18typedef enum {
19 eSftMsk4bits = 7,
20 eSftMsk8bits = 3,
21 eSftMsk16bits = 1,
22} nsSftMsk;
23
24typedef enum {
25 eBitSft4bits = 2,
26 eBitSft8bits = 3,
27 eBitSft16bits = 4,
28} nsBitSft;
29
30typedef enum {
31 eUnitMsk4bits = 0x0000000FL,
32 eUnitMsk8bits = 0x000000FFL,
33 eUnitMsk16bits = 0x0000FFFFL,
34} nsUnitMsk;
35
36typedef struct nsPkgInt {
37 nsIdxSft idxsft;
38 nsSftMsk sftmsk;
39 nsBitSft bitsft;
40 nsUnitMsk unitmsk;
41 const unsigned int *data;
42} nsPkgInt;
43}
44
45#define PCK16BITS(a, b) ((unsigned int)(((b) << 16) | (a)))
46
47#define PCK8BITS(a, b, c, d) PCK16BITS(((unsigned int)(((b) << 8) | (a))), ((unsigned int)(((d) << 8) | (c))))
48
49#define PCK4BITS(a, b, c, d, e, f, g, h) \
50 PCK8BITS(((unsigned int)(((b) << 4) | (a))), ((unsigned int)(((d) << 4) | (c))), ((unsigned int)(((f) << 4) | (e))), ((unsigned int)(((h) << 4) | (g))))
51
52#define GETFROMPCK(i, c) (((((c).data)[(i) >> (c).idxsft]) >> (((i) & (c).sftmsk) << (c).bitsft)) & (c).unitmsk)
53
54#endif /* nsPkgInt_h__ */
55

source code of kcodecs/src/probers/nsPkgInt.h