extensions/universalchardet/src/base/nsPkgInt.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsPkgInt_h__
michael@0 7 #define nsPkgInt_h__
michael@0 8 #include "nscore.h"
michael@0 9
michael@0 10 typedef enum {
michael@0 11 eIdxSft4bits = 3,
michael@0 12 eIdxSft8bits = 2,
michael@0 13 eIdxSft16bits = 1
michael@0 14 } nsIdxSft;
michael@0 15
michael@0 16 typedef enum {
michael@0 17 eSftMsk4bits = 7,
michael@0 18 eSftMsk8bits = 3,
michael@0 19 eSftMsk16bits = 1
michael@0 20 } nsSftMsk;
michael@0 21
michael@0 22 typedef enum {
michael@0 23 eBitSft4bits = 2,
michael@0 24 eBitSft8bits = 3,
michael@0 25 eBitSft16bits = 4
michael@0 26 } nsBitSft;
michael@0 27
michael@0 28 typedef enum {
michael@0 29 eUnitMsk4bits = 0x0000000FL,
michael@0 30 eUnitMsk8bits = 0x000000FFL,
michael@0 31 eUnitMsk16bits = 0x0000FFFFL
michael@0 32 } nsUnitMsk;
michael@0 33
michael@0 34 typedef struct nsPkgInt {
michael@0 35 nsIdxSft idxsft;
michael@0 36 nsSftMsk sftmsk;
michael@0 37 nsBitSft bitsft;
michael@0 38 nsUnitMsk unitmsk;
michael@0 39 const uint32_t* const data;
michael@0 40 } nsPkgInt;
michael@0 41
michael@0 42
michael@0 43 #define PCK16BITS(a,b) ((uint32_t)(((b) << 16) | (a)))
michael@0 44
michael@0 45 #define PCK8BITS(a,b,c,d) PCK16BITS( ((uint32_t)(((b) << 8) | (a))), \
michael@0 46 ((uint32_t)(((d) << 8) | (c))))
michael@0 47
michael@0 48 #define PCK4BITS(a,b,c,d,e,f,g,h) PCK8BITS( ((uint32_t)(((b) << 4) | (a))), \
michael@0 49 ((uint32_t)(((d) << 4) | (c))), \
michael@0 50 ((uint32_t)(((f) << 4) | (e))), \
michael@0 51 ((uint32_t)(((h) << 4) | (g))) )
michael@0 52
michael@0 53 #define GETFROMPCK(i, c) \
michael@0 54 (((((c).data)[(i)>>(c).idxsft])>>(((i)&(c).sftmsk)<<(c).bitsft))&(c).unitmsk)
michael@0 55
michael@0 56 #endif /* nsPkgInt_h__ */
michael@0 57

mercurial