162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Linux/PA-RISC Project (http://www.parisc-linux.org/) 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Floating-point emulation code 662306a36Sopenharmony_ci * Copyright (C) 2001 Hewlett-Packard (Paul Bame) <bame@debian.org> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifdef __NO_PA_HDRS 1062306a36Sopenharmony_ci PA header file -- do not include this header file for non-PA builds. 1162306a36Sopenharmony_ci#endif 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* 1562306a36Sopenharmony_ci * These macros are designed to be portable to all machines that have 1662306a36Sopenharmony_ci * a wordsize greater than or equal to 32 bits that support the portable 1762306a36Sopenharmony_ci * C compiler and the standard C preprocessor. Wordsize (default 32) 1862306a36Sopenharmony_ci * and bitfield assignment (default left-to-right, unlike VAX, PDP-11) 1962306a36Sopenharmony_ci * should be predefined using the constants HOSTWDSZ and BITFRL and 2062306a36Sopenharmony_ci * the C compiler "-D" flag (e.g., -DHOSTWDSZ=36 -DBITFLR for the DEC-20). 2162306a36Sopenharmony_ci * Note that the macro arguments assume that the integer being referenced 2262306a36Sopenharmony_ci * is a 32-bit integer (right-justified on the 20) and that bit 0 is the 2362306a36Sopenharmony_ci * most significant bit. 2462306a36Sopenharmony_ci */ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#ifndef HOSTWDSZ 2762306a36Sopenharmony_ci#define HOSTWDSZ 32 2862306a36Sopenharmony_ci#endif 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci/*########################### Macros ######################################*/ 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/*------------------------------------------------------------------------- 3462306a36Sopenharmony_ci * NewDeclareBitField_Reference - Declare a structure similar to the simulator 3562306a36Sopenharmony_ci * function "DeclBitfR" except its use is restricted to occur within a larger 3662306a36Sopenharmony_ci * enclosing structure or union definition. This declaration is an unnamed 3762306a36Sopenharmony_ci * structure with the argument, name, as the member name and the argument, 3862306a36Sopenharmony_ci * uname, as the element name. 3962306a36Sopenharmony_ci *----------------------------------------------------------------------- */ 4062306a36Sopenharmony_ci#define Bitfield_extract(start, length, object) \ 4162306a36Sopenharmony_ci ((object) >> (HOSTWDSZ - (start) - (length)) & \ 4262306a36Sopenharmony_ci ((unsigned)-1 >> (HOSTWDSZ - (length)))) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define Bitfield_signed_extract(start, length, object) \ 4562306a36Sopenharmony_ci ((int)((object) << start) >> (HOSTWDSZ - (length))) 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#define Bitfield_mask(start, len, object) \ 4862306a36Sopenharmony_ci ((object) & (((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len))) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define Bitfield_deposit(value,start,len,object) object = \ 5162306a36Sopenharmony_ci ((object) & ~(((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len))) | \ 5262306a36Sopenharmony_ci (((value) & ((unsigned)-1 >> (HOSTWDSZ-len))) << (HOSTWDSZ-start-len)) 53