gecko-dev/intl/chardet/src/nsPkgInt.h

70 строки
2.0 KiB
C
Исходник Обычный вид История

1999-06-25 00:44:56 +04:00
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsPkgInt_h__
#define nsPkgInt_h__
#include "nscore.h"
typedef enum {
eIdxSft4bits = 3,
eIdxSft8bits = 2,
eIdxSft16bits = 1
} nsIdxSft;
typedef enum {
eSftMsk4bits = 7,
eSftMsk8bits = 3,
eSftMsk16bits = 1
} nsSftMsk;
typedef enum {
eBitSft4bits = 2,
eBitSft8bits = 3,
eBitSft16bits = 4
} nsBitSft;
typedef enum {
eUnitMsk4bits = 0x0000000FL,
eUnitMsk8bits = 0x000000FFL,
eUnitMsk16bits = 0x0000FFFFL
} nsUnitMsk;
typedef struct nsPkgInt {
nsIdxSft idxsft;
nsSftMsk sftmsk;
nsBitSft bitsft;
nsUnitMsk unitmsk;
PRUint32 *data;
} nsPkgInt;
1999-07-17 00:44:02 +04:00
#define PCK16BITS(a,b) ((PRUint16)(((b) << 16) | (a)))
1999-07-17 00:44:02 +04:00
#define PCK8BITS(a,b,c,d) PCK16BITS( ((PRUint16)(((b) << 8) | (a))), \
((PRUint16)(((d) << 8) | (c))))
1999-07-17 00:44:02 +04:00
#define PCK4BITS(a,b,c,d,e,f,g,h) PCK8BITS( ((PRUint16)(((b) << 4) | (a))), \
((PRUint16)(((d) << 4) | (c))), \
((PRUint16)(((f) << 4) | (e))), \
((PRUint16)(((h) << 4) | (g))) )
1999-06-25 00:44:56 +04:00
#define GETFROMPCK(i, c) \
(((((c).data)[(i)>>(c).idxsft])>>(((i)&(c).sftmsk)<<(c).bitsft))&(c).unitmsk)
#endif /* nsPkgInt_h__ */