floatformat.h revision 89857
133965Sjdp/* IEEE floating point support declarations, for GDB, the GNU Debugger. 278828Sobrien Copyright 1991, 1994, 1995, 1997, 2000 Free Software Foundation, Inc. 333965Sjdp 433965SjdpThis file is part of GDB. 533965Sjdp 633965SjdpThis program is free software; you can redistribute it and/or modify 733965Sjdpit under the terms of the GNU General Public License as published by 833965Sjdpthe Free Software Foundation; either version 2 of the License, or 933965Sjdp(at your option) any later version. 1033965Sjdp 1133965SjdpThis program is distributed in the hope that it will be useful, 1233965Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of 1333965SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1433965SjdpGNU General Public License for more details. 1533965Sjdp 1633965SjdpYou should have received a copy of the GNU General Public License 1733965Sjdpalong with this program; if not, write to the Free Software 1833965SjdpFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 1933965Sjdp 2033965Sjdp#if !defined (FLOATFORMAT_H) 2133965Sjdp#define FLOATFORMAT_H 1 2233965Sjdp 2333965Sjdp#include "ansidecl.h" 2433965Sjdp 2533965Sjdp/* A floatformat consists of a sign bit, an exponent and a mantissa. Once the 2633965Sjdp bytes are concatenated according to the byteorder flag, then each of those 2733965Sjdp fields is contiguous. We number the bits with 0 being the most significant 2833965Sjdp (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field 2933965Sjdp contains with the *_start and *_len fields. */ 3033965Sjdp 3138889Sjdp/* What is the order of the bytes. */ 3233965Sjdp 3338889Sjdpenum floatformat_byteorders { 3438889Sjdp 3538889Sjdp /* Standard little endian byte order. 3638889Sjdp EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */ 3738889Sjdp 3838889Sjdp floatformat_little, 3938889Sjdp 4038889Sjdp /* Standard big endian byte order. 4138889Sjdp EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */ 4238889Sjdp 4338889Sjdp floatformat_big, 4438889Sjdp 4538889Sjdp /* Little endian byte order but big endian word order. 4638889Sjdp EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */ 4738889Sjdp 4838889Sjdp floatformat_littlebyte_bigword 4938889Sjdp 5038889Sjdp}; 5138889Sjdp 5233965Sjdpenum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no }; 5333965Sjdp 5433965Sjdpstruct floatformat 5533965Sjdp{ 5633965Sjdp enum floatformat_byteorders byteorder; 5733965Sjdp unsigned int totalsize; /* Total size of number in bits */ 5833965Sjdp 5933965Sjdp /* Sign bit is always one bit long. 1 means negative, 0 means positive. */ 6033965Sjdp unsigned int sign_start; 6133965Sjdp 6233965Sjdp unsigned int exp_start; 6333965Sjdp unsigned int exp_len; 6433965Sjdp /* Amount added to "true" exponent. 0x3fff for many IEEE extendeds. */ 6533965Sjdp unsigned int exp_bias; 6633965Sjdp /* Exponent value which indicates NaN. This is the actual value stored in 6733965Sjdp the float, not adjusted by the exp_bias. This usually consists of all 6833965Sjdp one bits. */ 6933965Sjdp unsigned int exp_nan; 7033965Sjdp 7133965Sjdp unsigned int man_start; 7233965Sjdp unsigned int man_len; 7333965Sjdp 7433965Sjdp /* Is the integer bit explicit or implicit? */ 7533965Sjdp enum floatformat_intbit intbit; 7677298Sobrien 7777298Sobrien /* Internal name for debugging. */ 7877298Sobrien const char *name; 7933965Sjdp}; 8033965Sjdp 8133965Sjdp/* floatformats for IEEE single and double, big and little endian. */ 8233965Sjdp 8333965Sjdpextern const struct floatformat floatformat_ieee_single_big; 8433965Sjdpextern const struct floatformat floatformat_ieee_single_little; 8533965Sjdpextern const struct floatformat floatformat_ieee_double_big; 8633965Sjdpextern const struct floatformat floatformat_ieee_double_little; 8733965Sjdp 8838889Sjdp/* floatformat for ARM IEEE double, little endian bytes and big endian words */ 8938889Sjdp 9038889Sjdpextern const struct floatformat floatformat_ieee_double_littlebyte_bigword; 9138889Sjdp 9233965Sjdp/* floatformats for various extendeds. */ 9333965Sjdp 9433965Sjdpextern const struct floatformat floatformat_i387_ext; 9533965Sjdpextern const struct floatformat floatformat_m68881_ext; 9633965Sjdpextern const struct floatformat floatformat_i960_ext; 9733965Sjdpextern const struct floatformat floatformat_m88110_ext; 9889857Sobrienextern const struct floatformat floatformat_m88110_harris_ext; 9989857Sobrienextern const struct floatformat floatformat_arm_ext; /* deprecated. */ 10089857Sobrienextern const struct floatformat floatformat_arm_ext_big; 10189857Sobrienextern const struct floatformat floatformat_arm_ext_littlebyte_bigword; 10289857Sobrien/* IA-64 Floating Point register spilt into memory. */ 10389857Sobrienextern const struct floatformat floatformat_ia64_spill_big; 10489857Sobrienextern const struct floatformat floatformat_ia64_spill_little; 10589857Sobrienextern const struct floatformat floatformat_ia64_quad_big; 10689857Sobrienextern const struct floatformat floatformat_ia64_quad_little; 10733965Sjdp 10833965Sjdp/* Convert from FMT to a double. 10933965Sjdp FROM is the address of the extended float. 11033965Sjdp Store the double in *TO. */ 11133965Sjdp 11233965Sjdpextern void 11333965Sjdpfloatformat_to_double PARAMS ((const struct floatformat *, char *, double *)); 11433965Sjdp 11533965Sjdp/* The converse: convert the double *FROM to FMT 11633965Sjdp and store where TO points. */ 11733965Sjdp 11833965Sjdpextern void 11933965Sjdpfloatformat_from_double PARAMS ((const struct floatformat *, 12033965Sjdp double *, char *)); 12133965Sjdp 12233965Sjdp#endif /* defined (FLOATFORMAT_H) */ 123