Blame src/nsPkgInt.h

Packit 67f6e7
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Packit 67f6e7
/* ***** BEGIN LICENSE BLOCK *****
Packit 67f6e7
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
Packit 67f6e7
 *
Packit 67f6e7
 * The contents of this file are subject to the Mozilla Public License Version
Packit 67f6e7
 * 1.1 (the "License"); you may not use this file except in compliance with
Packit 67f6e7
 * the License. You may obtain a copy of the License at
Packit 67f6e7
 * http://www.mozilla.org/MPL/
Packit 67f6e7
 *
Packit 67f6e7
 * Software distributed under the License is distributed on an "AS IS" basis,
Packit 67f6e7
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
Packit 67f6e7
 * for the specific language governing rights and limitations under the
Packit 67f6e7
 * License.
Packit 67f6e7
 *
Packit 67f6e7
 * The Original Code is mozilla.org code.
Packit 67f6e7
 *
Packit 67f6e7
 * The Initial Developer of the Original Code is
Packit 67f6e7
 * Netscape Communications Corporation.
Packit 67f6e7
 * Portions created by the Initial Developer are Copyright (C) 1998
Packit 67f6e7
 * the Initial Developer. All Rights Reserved.
Packit 67f6e7
 *
Packit 67f6e7
 * Contributor(s):
Packit 67f6e7
 *
Packit 67f6e7
 * Alternatively, the contents of this file may be used under the terms of
Packit 67f6e7
 * either the GNU General Public License Version 2 or later (the "GPL"), or
Packit 67f6e7
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
Packit 67f6e7
 * in which case the provisions of the GPL or the LGPL are applicable instead
Packit 67f6e7
 * of those above. If you wish to allow use of your version of this file only
Packit 67f6e7
 * under the terms of either the GPL or the LGPL, and not to allow others to
Packit 67f6e7
 * use your version of this file under the terms of the MPL, indicate your
Packit 67f6e7
 * decision by deleting the provisions above and replace them with the notice
Packit 67f6e7
 * and other provisions required by the GPL or the LGPL. If you do not delete
Packit 67f6e7
 * the provisions above, a recipient may use your version of this file under
Packit 67f6e7
 * the terms of any one of the MPL, the GPL or the LGPL.
Packit 67f6e7
 *
Packit 67f6e7
 * ***** END LICENSE BLOCK ***** */
Packit 67f6e7
Packit 67f6e7
#ifndef nsPkgInt_h__
Packit 67f6e7
#define nsPkgInt_h__
Packit 67f6e7
#include "nscore.h"
Packit 67f6e7
Packit 67f6e7
typedef enum {
Packit 67f6e7
  eIdxSft4bits  = 3,
Packit 67f6e7
  eIdxSft8bits  = 2,
Packit 67f6e7
  eIdxSft16bits = 1
Packit 67f6e7
} nsIdxSft; 
Packit 67f6e7
Packit 67f6e7
typedef enum {
Packit 67f6e7
  eSftMsk4bits  = 7,
Packit 67f6e7
  eSftMsk8bits  = 3,
Packit 67f6e7
  eSftMsk16bits = 1
Packit 67f6e7
} nsSftMsk; 
Packit 67f6e7
Packit 67f6e7
typedef enum {
Packit 67f6e7
  eBitSft4bits  = 2,
Packit 67f6e7
  eBitSft8bits  = 3,
Packit 67f6e7
  eBitSft16bits = 4
Packit 67f6e7
} nsBitSft; 
Packit 67f6e7
Packit 67f6e7
typedef enum {
Packit 67f6e7
  eUnitMsk4bits  = 0x0000000FL,
Packit 67f6e7
  eUnitMsk8bits  = 0x000000FFL,
Packit 67f6e7
  eUnitMsk16bits = 0x0000FFFFL
Packit 67f6e7
} nsUnitMsk; 
Packit 67f6e7
Packit 67f6e7
typedef struct nsPkgInt {
Packit 67f6e7
  nsIdxSft  idxsft;
Packit 67f6e7
  nsSftMsk  sftmsk;
Packit 67f6e7
  nsBitSft  bitsft;
Packit 67f6e7
  nsUnitMsk unitmsk;
Packit 67f6e7
  PRUint32  *data;
Packit 67f6e7
} nsPkgInt;
Packit 67f6e7
Packit 67f6e7
Packit 67f6e7
#define PCK16BITS(a,b)            ((PRUint32)(((b) << 16) | (a)))
Packit 67f6e7
Packit 67f6e7
#define PCK8BITS(a,b,c,d)         PCK16BITS( ((PRUint32)(((b) << 8) | (a))),  \
Packit 67f6e7
                                             ((PRUint32)(((d) << 8) | (c))))
Packit 67f6e7
Packit 67f6e7
#define PCK4BITS(a,b,c,d,e,f,g,h) PCK8BITS(  ((PRUint32)(((b) << 4) | (a))), \
Packit 67f6e7
                                             ((PRUint32)(((d) << 4) | (c))), \
Packit 67f6e7
                                             ((PRUint32)(((f) << 4) | (e))), \
Packit 67f6e7
                                             ((PRUint32)(((h) << 4) | (g))) )
Packit 67f6e7
Packit 67f6e7
#define GETFROMPCK(i, c) \
Packit 67f6e7
 (((((c).data)[(i)>>(c).idxsft])>>(((i)&(c).sftmsk)<<(c).bitsft))&(c).unitmsk)
Packit 67f6e7
Packit 67f6e7
#endif /* nsPkgInt_h__ */
Packit 67f6e7