From: DJ Delorie <dj@redhat.com>
To: cagney@gnu.org
Cc: binutils@sources.redhat.com, gdb-patches@sources.redhat.com
Subject: Re: [patch/rfc] Add host's floatformat
Date: Sun, 02 May 2004 20:49:00 -0000 [thread overview]
Message-ID: <200405020312.i423CSlH008732@greed.delorie.com> (raw)
In-Reply-To: <4093DC36.9040304@gnu.org> (message from Andrew Cagney on Sat, 01 May 2004 13:19:50 -0400)
Minor request: the functions should have "get" in there somewhere,
such as "floatformat_get_host_float" or "get_host_float_floatformat"
or something. I can be talked out of this, though.
As for the code, I was thinking of something like this (probably got
the bit patterns wrong):
struct {
float f;
int size;
unsigned char bits[8]; /* Expand as needed. */
const struct floatformat *ff;
} host_floats[] = {
{ 1.0, 4, {0x3f, 0xff, 0x00, 0x00, 0, 0, 0, 0 }, &floatformat_ieee_single_little },
{ 1.0, 4, {0x00, 0x00, 0xff, 0x3f, 0, 0, 0, 0 }, &floatformat_ieee_single_big }
/* Fill in more as needed, choosing values to ensure uniqueness. */
};
const struct floatformat *
floatformat_host_float ()
{
static floatformat *ff = 0;
static int ff_set = 0;
if (!ff_set)
{
int i;
ff_set = 1;
for (i=0; i<sizeof(host_floats)/sizeof(host_floats[0]); i++)
{
if (sizeof(float) == host_floats[i].size
&& memcmp (host_floats[i].f, host_floats[i].bits, sizeof(float)) == 0)
{
ff = host_floats[i].ff;
break;
}
}
}
return ff;
}
We'd have to put in suitable #ifdefs for the long double cases, of course.
next prev parent reply other threads:[~2004-05-02 20:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-01 12:53 Andrew Cagney
2004-05-01 13:25 ` DJ Delorie
2004-05-01 14:28 ` Andrew Cagney
2004-05-01 14:06 ` Andreas Schwab
2004-05-01 14:34 ` Mark Kettenis
2004-05-01 15:00 ` Andrew Cagney
2004-05-01 17:20 ` Andrew Cagney
2004-05-02 10:04 ` Mark Kettenis
2004-05-02 20:49 ` DJ Delorie
2004-05-02 20:49 ` DJ Delorie [this message]
2004-05-03 19:11 ` Andrew Cagney
2004-05-03 22:11 ` DJ Delorie
2004-05-03 22:29 ` Zack Weinberg
2004-05-03 22:34 ` DJ Delorie
2004-07-26 21:12 ` Andrew Cagney
2004-05-03 22:37 ` Andrew Cagney
2004-05-03 22:44 ` DJ Delorie
2004-05-03 23:21 ` Andrew Cagney
2004-05-03 23:48 ` DJ Delorie
2004-05-03 23:58 ` Zack Weinberg
2004-05-04 14:11 ` Andrew Cagney
2004-05-05 16:32 ` Andrew Cagney
2004-05-05 17:05 ` DJ Delorie
2004-07-29 19:35 ` Andrew Cagney
2004-07-30 9:46 ` Andreas Schwab
2004-07-30 13:26 ` Andrew Cagney
2004-11-20 18:17 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200405020312.i423CSlH008732@greed.delorie.com \
--to=dj@redhat.com \
--cc=binutils@sources.redhat.com \
--cc=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox