зеркало из https://github.com/mozilla/gecko-dev.git
74 строки
2.1 KiB
C
74 строки
2.1 KiB
C
/* -*- 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.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
|
|
#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;
|
|
|
|
|
|
#define PCK16BITS(a,b) ((PRUint32)(((b) << 16) | (a)))
|
|
|
|
#define PCK8BITS(a,b,c,d) PCK16BITS( ((PRUint32)(((b) << 8) | (a))), \
|
|
((PRUint32)(((d) << 8) | (c))))
|
|
|
|
#define PCK4BITS(a,b,c,d,e,f,g,h) PCK8BITS( ((PRUint32)(((b) << 4) | (a))), \
|
|
((PRUint32)(((d) << 4) | (c))), \
|
|
((PRUint32)(((f) << 4) | (e))), \
|
|
((PRUint32)(((h) << 4) | (g))) )
|
|
|
|
#define GETFROMPCK(i, c) \
|
|
(((((c).data)[(i)>>(c).idxsft])>>(((i)&(c).sftmsk)<<(c).bitsft))&(c).unitmsk)
|
|
|
|
#endif /* nsPkgInt_h__ */
|