KDECore
nsPkgInt.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* -*- C++ -*- 00003 * Copyright (C) 1998 <developer@mozilla.org> 00004 * 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining 00007 * a copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sublicense, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00018 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00020 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00021 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00022 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00023 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 #ifndef nsPkgInt_h__ 00027 #define nsPkgInt_h__ 00028 00029 namespace kencodingprober { 00030 typedef enum { 00031 eIdxSft4bits = 3, 00032 eIdxSft8bits = 2, 00033 eIdxSft16bits = 1 00034 } nsIdxSft; 00035 00036 typedef enum { 00037 eSftMsk4bits = 7, 00038 eSftMsk8bits = 3, 00039 eSftMsk16bits = 1 00040 } nsSftMsk; 00041 00042 typedef enum { 00043 eBitSft4bits = 2, 00044 eBitSft8bits = 3, 00045 eBitSft16bits = 4 00046 } nsBitSft; 00047 00048 typedef enum { 00049 eUnitMsk4bits = 0x0000000FL, 00050 eUnitMsk8bits = 0x000000FFL, 00051 eUnitMsk16bits = 0x0000FFFFL 00052 } nsUnitMsk; 00053 00054 typedef struct nsPkgInt { 00055 nsIdxSft idxsft; 00056 nsSftMsk sftmsk; 00057 nsBitSft bitsft; 00058 nsUnitMsk unitmsk; 00059 unsigned int *data; 00060 } nsPkgInt; 00061 } 00062 00063 #define PCK16BITS(a,b) ((unsigned int)(((b) << 16) | (a))) 00064 00065 #define PCK8BITS(a,b,c,d) PCK16BITS( ((unsigned int)(((b) << 8) | (a))), \ 00066 ((unsigned int)(((d) << 8) | (c)))) 00067 00068 #define PCK4BITS(a,b,c,d,e,f,g,h) PCK8BITS( ((unsigned int)(((b) << 4) | (a))), \ 00069 ((unsigned int)(((d) << 4) | (c))), \ 00070 ((unsigned int)(((f) << 4) | (e))), \ 00071 ((unsigned int)(((h) << 4) | (g))) ) 00072 00073 #define GETFROMPCK(i, c) \ 00074 (((((c).data)[(i)>>(c).idxsft])>>(((i)&(c).sftmsk)<<(c).bitsft))&(c).unitmsk) 00075 00076 #endif /* nsPkgInt_h__ */ 00077
KDE 4.6 API Reference