1997-08-22 00:57:35 +02:00
|
|
|
|
/* IEEE floating point support routines, for GDB, the GNU Debugger.
|
2021-01-04 10:26:59 +01:00
|
|
|
|
Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-10 17:33:18 +02:00
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
/* This is needed to pick up the NAN macro on some systems. */
|
2015-05-22 22:53:45 +02:00
|
|
|
|
#ifndef _GNU_SOURCE
|
2003-12-03 19:36:50 +01:00
|
|
|
|
#define _GNU_SOURCE
|
2015-05-22 22:53:45 +02:00
|
|
|
|
#endif
|
2003-12-03 19:36:50 +01:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-02-11 17:50:41 +01:00
|
|
|
|
/* On some platforms, <float.h> provides DBL_QNAN. */
|
|
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
|
#include <float.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-04-15 22:36:33 +02:00
|
|
|
|
#include "ansidecl.h"
|
2003-12-03 19:36:50 +01:00
|
|
|
|
#include "libiberty.h"
|
1997-08-22 00:57:35 +02:00
|
|
|
|
#include "floatformat.h"
|
2003-12-03 19:36:50 +01:00
|
|
|
|
|
|
|
|
|
#ifndef INFINITY
|
|
|
|
|
#ifdef HUGE_VAL
|
|
|
|
|
#define INFINITY HUGE_VAL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
#else
|
2003-12-03 19:36:50 +01:00
|
|
|
|
#define INFINITY (1.0 / 0.0)
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef NAN
|
2006-02-11 17:50:41 +01:00
|
|
|
|
#ifdef DBL_QNAN
|
|
|
|
|
#define NAN DBL_QNAN
|
|
|
|
|
#else
|
2003-12-03 19:36:50 +01:00
|
|
|
|
#define NAN (0.0 / 0.0)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
#endif
|
2006-02-11 17:50:41 +01:00
|
|
|
|
#endif
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
static int mant_bits_set (const struct floatformat *, const unsigned char *);
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
static unsigned long get_field (const unsigned char *,
|
|
|
|
|
enum floatformat_byteorders,
|
|
|
|
|
unsigned int,
|
|
|
|
|
unsigned int,
|
|
|
|
|
unsigned int);
|
|
|
|
|
static int floatformat_always_valid (const struct floatformat *fmt,
|
2005-08-17 19:30:47 +02:00
|
|
|
|
const void *from);
|
2003-09-22 19:42:03 +02:00
|
|
|
|
|
|
|
|
|
static int
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
|
2005-08-17 19:30:47 +02:00
|
|
|
|
const void *from ATTRIBUTE_UNUSED)
|
2003-09-22 19:42:03 +02:00
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not
|
|
|
|
|
going to bother with trying to muck around with whether it is defined in
|
|
|
|
|
a system header, what we do if not, etc. */
|
|
|
|
|
#define FLOATFORMAT_CHAR_BIT 8
|
|
|
|
|
|
2010-07-06 15:00:59 +02:00
|
|
|
|
/* floatformats for IEEE half, single and double, big and little endian. */
|
|
|
|
|
const struct floatformat floatformat_ieee_half_big =
|
|
|
|
|
{
|
|
|
|
|
floatformat_big, 16, 0, 1, 5, 15, 31, 6, 10,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_ieee_half_big",
|
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ieee_half_little =
|
|
|
|
|
{
|
|
|
|
|
floatformat_little, 16, 0, 1, 5, 15, 31, 6, 10,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_ieee_half_little",
|
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
|
|
|
|
};
|
1997-08-22 00:57:35 +02:00
|
|
|
|
const struct floatformat floatformat_ieee_single_big =
|
|
|
|
|
{
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ieee_single_big",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ieee_single_little =
|
|
|
|
|
{
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ieee_single_little",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ieee_double_big =
|
|
|
|
|
{
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ieee_double_big",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ieee_double_little =
|
|
|
|
|
{
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ieee_double_little",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* floatformat for IEEE double, little endian byte order, with big endian word
|
|
|
|
|
ordering, as on the ARM. */
|
|
|
|
|
|
|
|
|
|
const struct floatformat floatformat_ieee_double_littlebyte_bigword =
|
|
|
|
|
{
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ieee_double_littlebyte_bigword",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
|
2005-10-31 18:52:38 +01:00
|
|
|
|
/* floatformat for VAX. Not quite IEEE, but close enough. */
|
|
|
|
|
|
|
|
|
|
const struct floatformat floatformat_vax_f =
|
|
|
|
|
{
|
|
|
|
|
floatformat_vax, 32, 0, 1, 8, 129, 0, 9, 23,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_vax_f",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2005-10-31 18:52:38 +01:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_vax_d =
|
|
|
|
|
{
|
|
|
|
|
floatformat_vax, 64, 0, 1, 8, 129, 0, 9, 55,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_vax_d",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2005-10-31 18:52:38 +01:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_vax_g =
|
|
|
|
|
{
|
|
|
|
|
floatformat_vax, 64, 0, 1, 11, 1025, 0, 12, 52,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_vax_g",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2005-10-31 18:52:38 +01:00
|
|
|
|
};
|
|
|
|
|
|
2005-08-17 19:30:47 +02:00
|
|
|
|
static int floatformat_i387_ext_is_valid (const struct floatformat *fmt,
|
|
|
|
|
const void *from);
|
2003-09-22 19:42:03 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2005-08-17 19:30:47 +02:00
|
|
|
|
floatformat_i387_ext_is_valid (const struct floatformat *fmt, const void *from)
|
2003-09-22 19:42:03 +02:00
|
|
|
|
{
|
|
|
|
|
/* In the i387 double-extended format, if the exponent is all ones,
|
|
|
|
|
then the integer bit must be set. If the exponent is neither 0
|
|
|
|
|
nor ~0, the intbit must also be set. Only if the exponent is
|
|
|
|
|
zero can it be zero, and then it must be zero. */
|
|
|
|
|
unsigned long exponent, int_bit;
|
2005-12-17 18:21:34 +01:00
|
|
|
|
const unsigned char *ufrom = (const unsigned char *) from;
|
2005-08-17 19:30:47 +02:00
|
|
|
|
|
2003-09-22 19:42:03 +02:00
|
|
|
|
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
|
|
|
|
fmt->exp_start, fmt->exp_len);
|
|
|
|
|
int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
|
|
|
|
fmt->man_start, 1);
|
2005-08-17 19:30:47 +02:00
|
|
|
|
|
2003-09-22 19:42:03 +02:00
|
|
|
|
if ((exponent == 0) != (int_bit == 0))
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
const struct floatformat floatformat_i387_ext =
|
|
|
|
|
{
|
|
|
|
|
floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_i387_ext",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_i387_ext_is_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_m68881_ext =
|
|
|
|
|
{
|
|
|
|
|
/* Note that the bits from 16 to 31 are unused. */
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64,
|
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_m68881_ext",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_i960_ext =
|
|
|
|
|
{
|
|
|
|
|
/* Note that the bits from 0 to 15 are unused. */
|
|
|
|
|
floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64,
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_i960_ext",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_m88110_ext =
|
|
|
|
|
{
|
2001-08-21 02:09:09 +02:00
|
|
|
|
floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
|
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_m88110_ext",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_m88110_harris_ext =
|
|
|
|
|
{
|
1997-08-22 00:57:35 +02:00
|
|
|
|
/* Harris uses raw format 128 bytes long, but the number is just an ieee
|
|
|
|
|
double, and the last 64 bits are wasted. */
|
|
|
|
|
floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52,
|
2000-05-31 13:00:54 +02:00
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_m88110_ext_harris",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
1997-08-22 00:57:35 +02:00
|
|
|
|
};
|
2001-08-21 02:09:09 +02:00
|
|
|
|
const struct floatformat floatformat_arm_ext_big =
|
|
|
|
|
{
|
|
|
|
|
/* Bits 1 to 16 are unused. */
|
|
|
|
|
floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
|
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_arm_ext_big",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_arm_ext_littlebyte_bigword =
|
|
|
|
|
{
|
|
|
|
|
/* Bits 1 to 16 are unused. */
|
|
|
|
|
floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
|
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_arm_ext_littlebyte_bigword",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ia64_spill_big =
|
|
|
|
|
{
|
|
|
|
|
floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
|
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ia64_spill_big",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ia64_spill_little =
|
|
|
|
|
{
|
|
|
|
|
floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
|
|
|
|
|
floatformat_intbit_yes,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ia64_spill_little",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ia64_quad_big =
|
|
|
|
|
{
|
|
|
|
|
floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ia64_quad_big",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
|
|
|
|
const struct floatformat floatformat_ia64_quad_little =
|
|
|
|
|
{
|
|
|
|
|
floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
|
|
|
|
|
floatformat_intbit_no,
|
2003-09-22 19:42:03 +02:00
|
|
|
|
"floatformat_ia64_quad_little",
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
floatformat_ibm_long_double_is_valid (const struct floatformat *fmt,
|
|
|
|
|
const void *from)
|
|
|
|
|
{
|
|
|
|
|
const unsigned char *ufrom = (const unsigned char *) from;
|
|
|
|
|
const struct floatformat *hfmt = fmt->split_half;
|
|
|
|
|
long top_exp, bot_exp;
|
|
|
|
|
int top_nan = 0;
|
|
|
|
|
|
|
|
|
|
top_exp = get_field (ufrom, hfmt->byteorder, hfmt->totalsize,
|
|
|
|
|
hfmt->exp_start, hfmt->exp_len);
|
|
|
|
|
bot_exp = get_field (ufrom + 8, hfmt->byteorder, hfmt->totalsize,
|
|
|
|
|
hfmt->exp_start, hfmt->exp_len);
|
|
|
|
|
|
2007-11-13 01:37:43 +01:00
|
|
|
|
if ((unsigned long) top_exp == hfmt->exp_nan)
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
top_nan = mant_bits_set (hfmt, ufrom);
|
|
|
|
|
|
|
|
|
|
/* A NaN is valid with any low part. */
|
|
|
|
|
if (top_nan)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
/* An infinity, zero or denormal requires low part 0 (positive or
|
|
|
|
|
negative). */
|
2007-11-13 01:37:43 +01:00
|
|
|
|
if ((unsigned long) top_exp == hfmt->exp_nan || top_exp == 0)
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
{
|
|
|
|
|
if (bot_exp != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return !mant_bits_set (hfmt, ufrom + 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The top part is now a finite normal value. The long double value
|
|
|
|
|
is the sum of the two parts, and the top part must equal the
|
|
|
|
|
result of rounding the long double value to nearest double. Thus
|
|
|
|
|
the bottom part must be <= 0.5ulp of the top part in absolute
|
|
|
|
|
value, and if it is < 0.5ulp then the long double is definitely
|
|
|
|
|
valid. */
|
|
|
|
|
if (bot_exp < top_exp - 53)
|
|
|
|
|
return 1;
|
|
|
|
|
if (bot_exp > top_exp - 53 && bot_exp != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
if (bot_exp == 0)
|
|
|
|
|
{
|
|
|
|
|
/* The bottom part is 0 or denormal. Determine which, and if
|
|
|
|
|
denormal the first two set bits. */
|
|
|
|
|
int first_bit = -1, second_bit = -1, cur_bit;
|
2007-11-13 01:37:43 +01:00
|
|
|
|
for (cur_bit = 0; (unsigned int) cur_bit < hfmt->man_len; cur_bit++)
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
if (get_field (ufrom + 8, hfmt->byteorder, hfmt->totalsize,
|
|
|
|
|
hfmt->man_start + cur_bit, 1))
|
|
|
|
|
{
|
|
|
|
|
if (first_bit == -1)
|
|
|
|
|
first_bit = cur_bit;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
second_bit = cur_bit;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Bottom part 0 is OK. */
|
|
|
|
|
if (first_bit == -1)
|
|
|
|
|
return 1;
|
|
|
|
|
/* The real exponent of the bottom part is -first_bit. */
|
|
|
|
|
if (-first_bit < top_exp - 53)
|
|
|
|
|
return 1;
|
|
|
|
|
if (-first_bit > top_exp - 53)
|
|
|
|
|
return 0;
|
|
|
|
|
/* The bottom part is at least 0.5ulp of the top part. For this
|
|
|
|
|
to be OK, the bottom part must be exactly 0.5ulp (i.e. no
|
|
|
|
|
more bits set) and the top part must have last bit 0. */
|
|
|
|
|
if (second_bit != -1)
|
|
|
|
|
return 0;
|
|
|
|
|
return !get_field (ufrom, hfmt->byteorder, hfmt->totalsize,
|
|
|
|
|
hfmt->man_start + hfmt->man_len - 1, 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The bottom part is at least 0.5ulp of the top part. For this
|
|
|
|
|
to be OK, it must be exactly 0.5ulp (i.e. no explicit bits
|
|
|
|
|
set) and the top part must have last bit 0. */
|
|
|
|
|
if (get_field (ufrom, hfmt->byteorder, hfmt->totalsize,
|
|
|
|
|
hfmt->man_start + hfmt->man_len - 1, 1))
|
|
|
|
|
return 0;
|
|
|
|
|
return !mant_bits_set (hfmt, ufrom + 8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-20 07:31:41 +02:00
|
|
|
|
const struct floatformat floatformat_ibm_long_double_big =
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
{
|
|
|
|
|
floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
|
|
|
|
|
floatformat_intbit_no,
|
2013-08-20 07:31:41 +02:00
|
|
|
|
"floatformat_ibm_long_double_big",
|
2007-11-13 01:37:43 +01:00
|
|
|
|
floatformat_ibm_long_double_is_valid,
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
&floatformat_ieee_double_big
|
2001-08-21 02:09:09 +02:00
|
|
|
|
};
|
2013-08-20 07:31:41 +02:00
|
|
|
|
|
|
|
|
|
const struct floatformat floatformat_ibm_long_double_little =
|
|
|
|
|
{
|
|
|
|
|
floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_ibm_long_double_little",
|
|
|
|
|
floatformat_ibm_long_double_is_valid,
|
|
|
|
|
&floatformat_ieee_double_little
|
|
|
|
|
};
|
2020-08-17 13:36:49 +02:00
|
|
|
|
|
|
|
|
|
const struct floatformat floatformat_bfloat16_big =
|
|
|
|
|
{
|
|
|
|
|
floatformat_big, 16, 0, 1, 8, 127, 255, 9, 7,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_bfloat16_big",
|
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const struct floatformat floatformat_bfloat16_little =
|
|
|
|
|
{
|
|
|
|
|
floatformat_little, 16, 0, 1, 8, 127, 255, 9, 7,
|
|
|
|
|
floatformat_intbit_no,
|
|
|
|
|
"floatformat_bfloat16_little",
|
|
|
|
|
floatformat_always_valid,
|
|
|
|
|
NULL
|
|
|
|
|
};
|
2006-11-07 16:16:07 +01:00
|
|
|
|
|
|
|
|
|
#ifndef min
|
|
|
|
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
|
|
|
|
#endif
|
|
|
|
|
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
/* Return 1 if any bits are explicitly set in the mantissa of UFROM,
|
|
|
|
|
format FMT, 0 otherwise. */
|
|
|
|
|
static int
|
|
|
|
|
mant_bits_set (const struct floatformat *fmt, const unsigned char *ufrom)
|
|
|
|
|
{
|
|
|
|
|
unsigned int mant_bits, mant_off;
|
|
|
|
|
int mant_bits_left;
|
|
|
|
|
|
|
|
|
|
mant_off = fmt->man_start;
|
|
|
|
|
mant_bits_left = fmt->man_len;
|
|
|
|
|
while (mant_bits_left > 0)
|
|
|
|
|
{
|
|
|
|
|
mant_bits = min (mant_bits_left, 32);
|
|
|
|
|
|
|
|
|
|
if (get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
|
|
|
|
mant_off, mant_bits) != 0)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
mant_off += mant_bits;
|
|
|
|
|
mant_bits_left -= mant_bits;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-15 22:16:32 +02:00
|
|
|
|
/* Extract a field which starts at START and is LEN bits long. DATA and
|
1997-08-22 00:57:35 +02:00
|
|
|
|
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
|
|
|
|
|
static unsigned long
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
get_field (const unsigned char *data, enum floatformat_byteorders order,
|
|
|
|
|
unsigned int total_len, unsigned int start, unsigned int len)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
2006-11-07 16:16:07 +01:00
|
|
|
|
unsigned long result = 0;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
unsigned int cur_byte;
|
2006-11-07 16:16:07 +01:00
|
|
|
|
int lo_bit, hi_bit, cur_bitshift = 0;
|
|
|
|
|
int nextbyte = (order == floatformat_little) ? 1 : -1;
|
|
|
|
|
|
|
|
|
|
/* Start is in big-endian bit order! Fix that first. */
|
|
|
|
|
start = total_len - (start + len);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
/* Start at the least significant part of the field. */
|
|
|
|
|
if (order == floatformat_little)
|
2006-11-07 16:16:07 +01:00
|
|
|
|
cur_byte = start / FLOATFORMAT_CHAR_BIT;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
else
|
2006-11-07 16:16:07 +01:00
|
|
|
|
cur_byte = (total_len - start - 1) / FLOATFORMAT_CHAR_BIT;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
2006-11-07 16:16:07 +01:00
|
|
|
|
lo_bit = start % FLOATFORMAT_CHAR_BIT;
|
|
|
|
|
hi_bit = min (lo_bit + len, FLOATFORMAT_CHAR_BIT);
|
|
|
|
|
|
|
|
|
|
do
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
2006-11-07 16:16:07 +01:00
|
|
|
|
unsigned int shifted = *(data + cur_byte) >> lo_bit;
|
|
|
|
|
unsigned int bits = hi_bit - lo_bit;
|
|
|
|
|
unsigned int mask = (1 << bits) - 1;
|
|
|
|
|
result |= (shifted & mask) << cur_bitshift;
|
|
|
|
|
len -= bits;
|
|
|
|
|
cur_bitshift += bits;
|
|
|
|
|
cur_byte += nextbyte;
|
|
|
|
|
lo_bit = 0;
|
|
|
|
|
hi_bit = min (len, FLOATFORMAT_CHAR_BIT);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
}
|
2006-11-07 16:16:07 +01:00
|
|
|
|
while (len != 0);
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert from FMT to a double.
|
|
|
|
|
FROM is the address of the extended float.
|
|
|
|
|
Store the double in *TO. */
|
|
|
|
|
|
|
|
|
|
void
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
floatformat_to_double (const struct floatformat *fmt,
|
2005-08-17 19:30:47 +02:00
|
|
|
|
const void *from, double *to)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
2005-12-17 18:21:34 +01:00
|
|
|
|
const unsigned char *ufrom = (const unsigned char *) from;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
double dto;
|
|
|
|
|
long exponent;
|
|
|
|
|
unsigned long mant;
|
|
|
|
|
unsigned int mant_bits, mant_off;
|
|
|
|
|
int mant_bits_left;
|
|
|
|
|
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
/* Split values are not handled specially, since the top half has
|
|
|
|
|
the correctly rounded double value (in the only supported case of
|
|
|
|
|
split values). */
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
|
|
|
|
fmt->exp_start, fmt->exp_len);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
|
|
|
|
|
/* If the exponent indicates a NaN, we don't have information to
|
|
|
|
|
decide what to do. So we handle it like IEEE, except that we
|
|
|
|
|
don't try to preserve the type of NaN. FIXME. */
|
|
|
|
|
if ((unsigned long) exponent == fmt->exp_nan)
|
|
|
|
|
{
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
int nan = mant_bits_set (fmt, ufrom);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
|
2005-07-12 08:11:30 +02:00
|
|
|
|
/* On certain systems (such as GNU/Linux), the use of the
|
2019-01-09 22:39:49 +01:00
|
|
|
|
INFINITY macro below may generate a warning that cannot be
|
2005-07-12 08:11:30 +02:00
|
|
|
|
silenced due to a bug in GCC (PR preprocessor/11931). The
|
|
|
|
|
preprocessor fails to recognise the __extension__ keyword in
|
|
|
|
|
conjunction with the GNU/C99 extension for hexadecimal
|
|
|
|
|
floating point constants and will issue a warning when
|
|
|
|
|
compiling with -pedantic. */
|
2003-12-03 19:36:50 +01:00
|
|
|
|
if (nan)
|
|
|
|
|
dto = NAN;
|
|
|
|
|
else
|
|
|
|
|
dto = INFINITY;
|
|
|
|
|
|
|
|
|
|
if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
|
|
|
|
|
dto = -dto;
|
|
|
|
|
|
|
|
|
|
*to = dto;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
mant_bits_left = fmt->man_len;
|
|
|
|
|
mant_off = fmt->man_start;
|
|
|
|
|
dto = 0.0;
|
|
|
|
|
|
|
|
|
|
/* Build the result algebraically. Might go infinite, underflow, etc;
|
|
|
|
|
who cares. */
|
|
|
|
|
|
2012-08-17 23:56:48 +02:00
|
|
|
|
/* For denorms use minimum exponent. */
|
|
|
|
|
if (exponent == 0)
|
|
|
|
|
exponent = 1 - fmt->exp_bias;
|
|
|
|
|
else
|
1998-12-22 07:57:17 +01:00
|
|
|
|
{
|
2012-08-17 23:56:48 +02:00
|
|
|
|
exponent -= fmt->exp_bias;
|
|
|
|
|
|
|
|
|
|
/* If this format uses a hidden bit, explicitly add it in now.
|
|
|
|
|
Otherwise, increment the exponent by one to account for the
|
|
|
|
|
integer bit. */
|
|
|
|
|
|
1998-12-22 07:57:17 +01:00
|
|
|
|
if (fmt->intbit == floatformat_intbit_no)
|
|
|
|
|
dto = ldexp (1.0, exponent);
|
|
|
|
|
else
|
|
|
|
|
exponent++;
|
|
|
|
|
}
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
while (mant_bits_left > 0)
|
|
|
|
|
{
|
|
|
|
|
mant_bits = min (mant_bits_left, 32);
|
|
|
|
|
|
|
|
|
|
mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
|
|
|
|
mant_off, mant_bits);
|
|
|
|
|
|
2012-08-17 23:56:48 +02:00
|
|
|
|
dto += ldexp ((double) mant, exponent - mant_bits);
|
|
|
|
|
exponent -= mant_bits;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
mant_off += mant_bits;
|
|
|
|
|
mant_bits_left -= mant_bits;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Negate it if negative. */
|
|
|
|
|
if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
|
|
|
|
|
dto = -dto;
|
|
|
|
|
*to = dto;
|
|
|
|
|
}
|
|
|
|
|
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
static void put_field (unsigned char *, enum floatformat_byteorders,
|
|
|
|
|
unsigned int,
|
|
|
|
|
unsigned int,
|
|
|
|
|
unsigned int,
|
|
|
|
|
unsigned long);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
2003-09-15 22:16:32 +02:00
|
|
|
|
/* Set a field which starts at START and is LEN bits long. DATA and
|
1997-08-22 00:57:35 +02:00
|
|
|
|
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
|
|
|
|
|
static void
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
put_field (unsigned char *data, enum floatformat_byteorders order,
|
|
|
|
|
unsigned int total_len, unsigned int start, unsigned int len,
|
|
|
|
|
unsigned long stuff_to_put)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned int cur_byte;
|
2006-11-07 16:16:07 +01:00
|
|
|
|
int lo_bit, hi_bit;
|
|
|
|
|
int nextbyte = (order == floatformat_little) ? 1 : -1;
|
|
|
|
|
|
|
|
|
|
/* Start is in big-endian bit order! Fix that first. */
|
|
|
|
|
start = total_len - (start + len);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
/* Start at the least significant part of the field. */
|
|
|
|
|
if (order == floatformat_little)
|
2006-11-07 16:16:07 +01:00
|
|
|
|
cur_byte = start / FLOATFORMAT_CHAR_BIT;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
else
|
2006-11-07 16:16:07 +01:00
|
|
|
|
cur_byte = (total_len - start - 1) / FLOATFORMAT_CHAR_BIT;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
2006-11-07 16:16:07 +01:00
|
|
|
|
lo_bit = start % FLOATFORMAT_CHAR_BIT;
|
|
|
|
|
hi_bit = min (lo_bit + len, FLOATFORMAT_CHAR_BIT);
|
|
|
|
|
|
|
|
|
|
do
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
2006-11-07 16:16:07 +01:00
|
|
|
|
unsigned char *byte_ptr = data + cur_byte;
|
|
|
|
|
unsigned int bits = hi_bit - lo_bit;
|
|
|
|
|
unsigned int mask = ((1 << bits) - 1) << lo_bit;
|
|
|
|
|
*byte_ptr = (*byte_ptr & ~mask) | ((stuff_to_put << lo_bit) & mask);
|
|
|
|
|
stuff_to_put >>= bits;
|
|
|
|
|
len -= bits;
|
|
|
|
|
cur_byte += nextbyte;
|
|
|
|
|
lo_bit = 0;
|
|
|
|
|
hi_bit = min (len, FLOATFORMAT_CHAR_BIT);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
}
|
2006-11-07 16:16:07 +01:00
|
|
|
|
while (len != 0);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The converse: convert the double *FROM to an extended float
|
|
|
|
|
and store where TO points. Neither FROM nor TO have any alignment
|
|
|
|
|
restrictions. */
|
|
|
|
|
|
|
|
|
|
void
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
floatformat_from_double (const struct floatformat *fmt,
|
2005-08-17 19:30:47 +02:00
|
|
|
|
const double *from, void *to)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
|
|
|
|
double dfrom;
|
|
|
|
|
int exponent;
|
|
|
|
|
double mant;
|
|
|
|
|
unsigned int mant_bits, mant_off;
|
|
|
|
|
int mant_bits_left;
|
2005-12-17 18:21:34 +01:00
|
|
|
|
unsigned char *uto = (unsigned char *) to;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
dfrom = *from;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
|
floatformat.h (struct floatformat): Add split_half field.
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>
From-SVN: r129977
2007-11-08 01:08:02 +01:00
|
|
|
|
/* Split values are not handled specially, since a bottom half of
|
|
|
|
|
zero is correct for any value representable as double (in the
|
|
|
|
|
only supported case of split values). */
|
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
/* If negative, set the sign bit. */
|
|
|
|
|
if (dfrom < 0)
|
|
|
|
|
{
|
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1);
|
|
|
|
|
dfrom = -dfrom;
|
|
|
|
|
}
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
if (dfrom == 0)
|
2003-12-03 19:36:50 +01:00
|
|
|
|
{
|
|
|
|
|
/* 0.0. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
if (dfrom != dfrom)
|
|
|
|
|
{
|
2003-12-03 19:36:50 +01:00
|
|
|
|
/* NaN. */
|
1997-08-22 00:57:35 +02:00
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
|
|
|
|
|
fmt->exp_len, fmt->exp_nan);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
/* Be sure it's not infinity, but NaN value is irrelevant. */
|
1997-08-22 00:57:35 +02:00
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start,
|
|
|
|
|
32, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
if (dfrom + dfrom == dfrom)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
2003-12-03 19:36:50 +01:00
|
|
|
|
/* This can only happen for an infinite value (or zero, which we
|
|
|
|
|
already handled above). */
|
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
|
|
|
|
|
fmt->exp_len, fmt->exp_nan);
|
|
|
|
|
return;
|
1997-08-22 00:57:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mant = frexp (dfrom, &exponent);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
if (exponent + fmt->exp_bias - 1 > 0)
|
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
|
|
|
|
|
fmt->exp_len, exponent + fmt->exp_bias - 1);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Handle a denormalized number. FIXME: What should we do for
|
|
|
|
|
non-IEEE formats? */
|
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
|
|
|
|
|
fmt->exp_len, 0);
|
|
|
|
|
mant = ldexp (mant, exponent + fmt->exp_bias - 1);
|
|
|
|
|
}
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
mant_bits_left = fmt->man_len;
|
|
|
|
|
mant_off = fmt->man_start;
|
|
|
|
|
while (mant_bits_left > 0)
|
|
|
|
|
{
|
|
|
|
|
unsigned long mant_long;
|
|
|
|
|
mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;
|
|
|
|
|
|
|
|
|
|
mant *= 4294967296.0;
|
|
|
|
|
mant_long = (unsigned long)mant;
|
|
|
|
|
mant -= mant_long;
|
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
/* If the integer bit is implicit, and we are not creating a
|
|
|
|
|
denormalized number, then we need to discard it. */
|
2000-03-24 22:32:08 +01:00
|
|
|
|
if ((unsigned int) mant_bits_left == fmt->man_len
|
2003-12-03 19:36:50 +01:00
|
|
|
|
&& fmt->intbit == floatformat_intbit_no
|
|
|
|
|
&& exponent + fmt->exp_bias - 1 > 0)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
|
|
|
|
mant_long &= 0x7fffffff;
|
|
|
|
|
mant_bits -= 1;
|
|
|
|
|
}
|
|
|
|
|
else if (mant_bits < 32)
|
|
|
|
|
{
|
|
|
|
|
/* The bits we want are in the most significant MANT_BITS bits of
|
|
|
|
|
mant_long. Move them to the least significant. */
|
|
|
|
|
mant_long >>= 32 - mant_bits;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
put_field (uto, fmt->byteorder, fmt->totalsize,
|
|
|
|
|
mant_off, mant_bits, mant_long);
|
|
|
|
|
mant_off += mant_bits;
|
|
|
|
|
mant_bits_left -= mant_bits;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-15 22:16:32 +02:00
|
|
|
|
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
|
|
|
|
|
|
|
|
|
|
int
|
2005-08-17 19:30:47 +02:00
|
|
|
|
floatformat_is_valid (const struct floatformat *fmt, const void *from)
|
2003-09-15 22:16:32 +02:00
|
|
|
|
{
|
2003-09-22 19:42:03 +02:00
|
|
|
|
return fmt->is_valid (fmt, from);
|
2003-09-15 22:16:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
#ifdef IEEE_DEBUG
|
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
|
/* This is to be run on a host which uses IEEE floating point. */
|
|
|
|
|
|
|
|
|
|
void
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
ieee_test (double n)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
|
|
|
|
double result;
|
|
|
|
|
|
2005-08-17 19:30:47 +02:00
|
|
|
|
floatformat_to_double (&floatformat_ieee_double_little, &n, &result);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
if ((n != result && (! isnan (n) || ! isnan (result)))
|
|
|
|
|
|| (n < 0 && result >= 0)
|
|
|
|
|
|| (n >= 0 && result < 0))
|
1997-08-22 00:57:35 +02:00
|
|
|
|
printf ("Differ(to): %.20g -> %.20g\n", n, result);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
|
2005-08-17 19:30:47 +02:00
|
|
|
|
floatformat_from_double (&floatformat_ieee_double_little, &n, &result);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
if ((n != result && (! isnan (n) || ! isnan (result)))
|
|
|
|
|
|| (n < 0 && result >= 0)
|
|
|
|
|
|| (n >= 0 && result < 0))
|
1997-08-22 00:57:35 +02:00
|
|
|
|
printf ("Differ(from): %.20g -> %.20g\n", n, result);
|
|
|
|
|
|
2003-12-03 19:36:50 +01:00
|
|
|
|
#if 0
|
|
|
|
|
{
|
|
|
|
|
char exten[16];
|
|
|
|
|
|
|
|
|
|
floatformat_from_double (&floatformat_m68881_ext, &n, exten);
|
|
|
|
|
floatformat_to_double (&floatformat_m68881_ext, exten, &result);
|
|
|
|
|
if (n != result)
|
|
|
|
|
printf ("Differ(to+from): %.20g -> %.20g\n", n, result);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
|
|
#if IEEE_DEBUG > 1
|
|
|
|
|
/* This is to be run on a host which uses 68881 format. */
|
|
|
|
|
{
|
|
|
|
|
long double ex = *(long double *)exten;
|
|
|
|
|
if (ex != n)
|
|
|
|
|
printf ("Differ(from vs. extended): %.20g\n", n);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
md5.h: Remove definition and uses of __P.
include/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
* md5.h: Remove definition and uses of __P.
* dyn-string.h: Remove uses of PARAMS.
* fibheap.h: Likewise.
* floatformat.h: Likewise.
* hashtab.h: Likewise.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 4/n.
* hashtab.c (higher_prime_index, hash_pointer, eq_pointer,
htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2,
htab_create_alloc, htab_set_functions_ex, htab_create,
htab_try_create, htab_delete, htab_empty,
find_empty_slot_for_expand, htab_expand, htab_find_with_hash,
htab_find, htab_find_slot_with_hash, htab_find_slot,
htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot,
htab_traverse_noresize, htab_traverse, htab_collisions,
htab_hash_string, iterative_hash): Use ISO C prototype.
* hex.c (hex_init): Likewise.
* index.c (index): Likewise.
* insque.c (insque, remque): Likewise.
* lbasename.c (lbasename): Likewise.
* lrealpath.c (lrealpath): Likewise.
* make-relative-prefix.c (save_string, split_directories,
free_split_directories, make_relative_prefix): Likewise.
* make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise.
* md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream,
md5_buffer, md5_process_bytes, md5_process_block): Likewise.
* memchr.c (memchr): Likewise.
* memcpy.c (memcpy): Likewise.
* memmove.c (memmove): Likewise.
* gettimeofday.c (gettimeofday): Likewise.
* getruntime.c (get_run_time): Likewise.
* getpwd.c (getpwd, getpwd): Likewise.
* getpagesize.c (getpagesize): Likewise.
* getopt1.c (getopt_long, getopt_long_only, main): Likewise.
* getopt.c (my_index, exchange, _getopt_initialize,
_getopt_internal, getopt, main): Likewise.
* getcwd.c (getcwd): Likewise.
* fnmatch.c (fnmatch): Likewise.
* floatformat.c (floatformat_always_valid,
floatformat_i387_ext_is_valid, get_field, floatformat_to_double,
put_field, floatformat_from_double, floatformat_is_valid,
ieee_test, main): Likewise.
* fibheap.c (fibheap_new, fibnode_new, fibheap_compare,
fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key,
fibheap_union, fibheap_extract_min, fibheap_replace_key_data,
fibheap_replace_key, fibheap_replace_data, fibheap_delete_node,
fibheap_delete, fibheap_empty, fibheap_extr_min_node,
fibheap_ins_root, fibheap_rem_root, fibheap_consolidate,
fibheap_link, fibheap_cut, fibheap_cascading_cut,
fibnode_insert_after, fibnode_remove): Likewise.
* ffs.c (ffs): Likewise.
* fdmatch.c (fdmatch): Likewise.
* dyn-string.c (dyn_string_init, dyn_string_new,
dyn_string_delete, dyn_string_release, dyn_string_resize,
dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
dyn_string_insert_cstr, dyn_string_insert_char,
dyn_string_append, dyn_string_append_cstr,
dyn_string_append_char, dyn_string_substring, dyn_string_eq):
Likewise.
From-SVN: r97113
2005-03-27 17:31:13 +02:00
|
|
|
|
main (void)
|
1997-08-22 00:57:35 +02:00
|
|
|
|
{
|
2003-12-03 19:36:50 +01:00
|
|
|
|
ieee_test (0.0);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
ieee_test (0.5);
|
2012-08-17 23:56:48 +02:00
|
|
|
|
ieee_test (1.1);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
ieee_test (256.0);
|
|
|
|
|
ieee_test (0.12345);
|
|
|
|
|
ieee_test (234235.78907234);
|
|
|
|
|
ieee_test (-512.0);
|
|
|
|
|
ieee_test (-0.004321);
|
2003-12-03 19:36:50 +01:00
|
|
|
|
ieee_test (1.2E-70);
|
|
|
|
|
ieee_test (1.2E-316);
|
|
|
|
|
ieee_test (4.9406564584124654E-324);
|
|
|
|
|
ieee_test (- 4.9406564584124654E-324);
|
|
|
|
|
ieee_test (- 0.0);
|
|
|
|
|
ieee_test (- INFINITY);
|
|
|
|
|
ieee_test (- NAN);
|
|
|
|
|
ieee_test (INFINITY);
|
|
|
|
|
ieee_test (NAN);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|