[BACK]Return to fpbits.h CVS log [TXT][DIR] Up to [local] / sys / arch / hppa / spmath

Annotation of sys/arch/hppa/spmath/fpbits.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: fpbits.h,v 1.6 2002/09/20 19:26:59 mickey Exp $       */
                      2: /*
                      3:   (c) Copyright 1986 HEWLETT-PACKARD COMPANY
                      4:   To anyone who acknowledges that this file is provided "AS IS"
                      5:   without any express or implied warranty:
                      6:       permission to use, copy, modify, and distribute this file
                      7:   for any purpose is hereby granted without fee, provided that
                      8:   the above copyright notice and this notice appears in all
                      9:   copies, and that the name of Hewlett-Packard Company not be
                     10:   used in advertising or publicity pertaining to distribution
                     11:   of the software without specific, written prior permission.
                     12:   Hewlett-Packard Company makes no representations about the
                     13:   suitability of this software for any purpose.
                     14: */
                     15: /* @(#)fpbits.h: Revision: 1.6.88.1 Date: 93/12/07 15:06:21 */
                     16:
                     17: /*
                     18:  *  These macros are designed to be portable to all machines that have
                     19:  *  a wordsize greater than or equal to 32 bits that support the portable
                     20:  *  C compiler and the standard C preprocessor.  Wordsize (default 32)
                     21:  *  and bitfield assignment (default left-to-right,  unlike VAX, PDP-11)
                     22:  *  should be predefined using the constants HOSTWDSZ and BITFRL and
                     23:  *  the C compiler "-D" flag (e.g., -DHOSTWDSZ=36 -DBITFLR for the DEC-20).
                     24:  *  Note that the macro arguments assume that the integer being referenced
                     25:  *  is a 32-bit integer (right-justified on the 20) and that bit 0 is the
                     26:  *  most significant bit.
                     27:  */
                     28:
                     29: #ifndef HOSTWDSZ
                     30: #define        HOSTWDSZ        32
                     31: #endif
                     32:
                     33:
                     34: /*###########################  Macros  ######################################*/
                     35:
                     36: /*-------------------------------------------------------------------------
                     37:  * NewDeclareBitField_Reference - Declare a structure similar to the simulator
                     38:  * function "DeclBitfR" except its use is restricted to occur within a larger
                     39:  * enclosing structure or union definition.  This declaration is an unnamed
                     40:  * structure with the argument, name, as the member name and the argument,
                     41:  * uname, as the element name.
                     42:  *----------------------------------------------------------------------- */
                     43: #define Bitfield_extract(start, length, object)                \
                     44:     ((object) >> (HOSTWDSZ - (start) - (length)) &     \
                     45:     ((unsigned)-1 >> (HOSTWDSZ - (length))))
                     46:
                     47: #define Bitfield_signed_extract(start, length, object) \
                     48:     ((int)((object) << start) >> (HOSTWDSZ - (length)))
                     49:
                     50: #define Bitfield_mask(start, len, object)              \
                     51:     ((object) & (((unsigned)-1 >> (HOSTWDSZ-len)) << (HOSTWDSZ-start-len)))
                     52:
                     53: #define Bitfield_deposit(value,start,len,object)  object = \
                     54:     ((object) & ~(((unsigned)-1 >> (HOSTWDSZ-(len))) << (HOSTWDSZ-(start)-(len)))) | \
                     55:     (((value) & ((unsigned)-1 >> (HOSTWDSZ-(len)))) << (HOSTWDSZ-(start)-(len)))

CVSweb