/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* Linux/PA-RISC Project (http://www.parisc-linux.org/)3*4* Floating-point emulation code5* Copyright (C) 2001 Hewlett-Packard (Paul Bame) <[email protected]>6*/78#ifdef __NO_PA_HDRS9PA header file -- do not include this header file for non-PA builds.10#endif111213/*14* These macros are designed to be portable to all machines that have15* a wordsize greater than or equal to 32 bits that support the portable16* C compiler and the standard C preprocessor. Wordsize (default 32)17* and bitfield assignment (default left-to-right, unlike VAX, PDP-11)18* should be predefined using the constants HOSTWDSZ and BITFRL and19* the C compiler "-D" flag (e.g., -DHOSTWDSZ=36 -DBITFLR for the DEC-20).20* Note that the macro arguments assume that the integer being referenced21* is a 32-bit integer (right-justified on the 20) and that bit 0 is the22* most significant bit.23*/2425#ifndef HOSTWDSZ26#define HOSTWDSZ 3227#endif282930/*########################### Macros ######################################*/3132/*-------------------------------------------------------------------------33* NewDeclareBitField_Reference - Declare a structure similar to the simulator34* function "DeclBitfR" except its use is restricted to occur within a larger35* enclosing structure or union definition. This declaration is an unnamed36* structure with the argument, name, as the member name and the argument,37* uname, as the element name.38*----------------------------------------------------------------------- */39#define Bitfield_extract(start, length, object) \40((object) >> (HOSTWDSZ - (start) - (length)) & \41((unsigned)-1 >> (HOSTWDSZ - (length))))4243#define Bitfield_signed_extract(start, length, object) \44((int)((object) << start) >> (HOSTWDSZ - (length)))4546#define Bitfield_mask(start, len, object) \47((object) & (((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len)))4849#define Bitfield_deposit(value,start,len,object) object = \50((object) & ~(((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len))) | \51(((value) & ((unsigned)-1 >> (HOSTWDSZ-len))) << (HOSTWDSZ-start-len))525354