/*1* Linux/PA-RISC Project (http://www.parisc-linux.org/)2*3* Floating-point emulation code4* Copyright (C) 2001 Hewlett-Packard (Paul Bame) <[email protected]>5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2, or (at your option)9* any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19*/2021#ifdef __NO_PA_HDRS22PA header file -- do not include this header file for non-PA builds.23#endif242526/*27* These macros are designed to be portable to all machines that have28* a wordsize greater than or equal to 32 bits that support the portable29* C compiler and the standard C preprocessor. Wordsize (default 32)30* and bitfield assignment (default left-to-right, unlike VAX, PDP-11)31* should be predefined using the constants HOSTWDSZ and BITFRL and32* the C compiler "-D" flag (e.g., -DHOSTWDSZ=36 -DBITFLR for the DEC-20).33* Note that the macro arguments assume that the integer being referenced34* is a 32-bit integer (right-justified on the 20) and that bit 0 is the35* most significant bit.36*/3738#ifndef HOSTWDSZ39#define HOSTWDSZ 3240#endif414243/*########################### Macros ######################################*/4445/*-------------------------------------------------------------------------46* NewDeclareBitField_Reference - Declare a structure similar to the simulator47* function "DeclBitfR" except its use is restricted to occur within a larger48* enclosing structure or union definition. This declaration is an unnamed49* structure with the argument, name, as the member name and the argument,50* uname, as the element name.51*----------------------------------------------------------------------- */52#define Bitfield_extract(start, length, object) \53((object) >> (HOSTWDSZ - (start) - (length)) & \54((unsigned)-1 >> (HOSTWDSZ - (length))))5556#define Bitfield_signed_extract(start, length, object) \57((int)((object) << start) >> (HOSTWDSZ - (length)))5859#define Bitfield_mask(start, len, object) \60((object) & (((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len)))6162#define Bitfield_deposit(value,start,len,object) object = \63((object) & ~(((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len))) | \64(((value) & ((unsigned)-1 >> (HOSTWDSZ-len))) << (HOSTWDSZ-start-len))656667