From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com, binutils@sources.redhat.com,
gcc-patches@gcc.gnu.org
Subject: Re: [libiberty and gdb] floatformat_is_valid
Date: Mon, 15 Sep 2003 20:58:00 -0000 [thread overview]
Message-ID: <20030915205815.GA4563@nevyn.them.org> (raw)
In-Reply-To: <3F6626F9.90003@redhat.com>
On Mon, Sep 15, 2003 at 04:54:17PM -0400, Andrew Cagney wrote:
> >+/* Return non-zero iff the data at FROM is a valid number in format FMT.
> >*/
> >+
> >+int
> >+floatformat_is_valid (fmt, from)
> >+ const struct floatformat *fmt;
> >+ char *from;
> >+{
>
> Shouldn't this be a new virtual method in floatformat?
Floatformats don't have any virtual methods right now; if you want to
add them, be my guest. Besides, this is more in line with the
libiberty policy of backwards compatibility, since it does not change
the structure layout.
>
> >+ if (fmt == &floatformat_i387_ext)
> >+ {
> >+ /* 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 int exponent, int_bit;
> >+ unsigned char *ufrom = (unsigned char *) from;
> >+
> >+ 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);
> >+
> >+ if ((exponent == 0) != (int_bit == 0))
> >+ return 0;
> >+ else
> >+ return 1;
> >+ }
> >+
> >+ /* Other formats with invalid representations should be added
> >+ here. */
> >+ return 1;
> > }
>
> Andrew
>
>
>
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-09-15 20:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-15 14:39 Daniel Jacobowitz
2003-09-15 17:57 ` DJ Delorie
2003-09-15 20:33 ` Daniel Jacobowitz
2003-09-15 20:54 ` Andrew Cagney
2003-09-15 20:58 ` Daniel Jacobowitz [this message]
2003-09-15 21:04 ` Andrew Cagney
2003-09-15 21:48 ` DJ Delorie
2003-09-16 2:57 ` Andrew Cagney
2003-09-16 3:10 ` DJ Delorie
2003-09-22 17:43 ` Andrew Cagney
2003-09-15 21:22 ` Andrew Cagney
2003-09-15 21:52 ` Mark Kettenis
2003-09-18 20:31 ` Daniel Jacobowitz
2003-09-18 22:59 ` Andrew Cagney
2003-09-21 19:11 ` Daniel Jacobowitz
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=20030915205815.GA4563@nevyn.them.org \
--to=drow@mvista.com \
--cc=ac131313@redhat.com \
--cc=binutils@sources.redhat.com \
--cc=gcc-patches@gcc.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