2 msgFailed build of AVR cross-compiler with combine...
2 msgunwind problem when cross compiling
1 msgvoli low cost
1 msgfluupe

Soft float support and casting
\ Simon Kagstrom (29 Nov 2006)
. \ John Love-Jensen (29 Nov 2006)
. \ Michael Eager (29 Nov 2006)
. . \ Simon Kagstrom (29 Nov 2006)

1 msgcompiling errors with options '-fprofile-arcs -...
8 msgUnclear documentation on building GCC together ...
8 msgalloca attribute?
3 msgchanges made to gmon-sol2.c not reflected after...
2 msgCompiling error when changing to gcc4.1.1
1 msgenums, switches, and warnings?
1 msgException stack too large
5 msgprefetching on pentium 4
2 msgHow, i can work with read-rtl.c
5 msggcc for ppc
2 msgDifferent versions created executable's compati...
2 msgEasy linker problem
2 msgA bug with variables and functions of the same ...
1 msgTracking operator ==
2 msggcc 3.0 and linux kernel
Subject:Re: Soft float support and casting
Group:Gcc-help
From:Simon Kagstrom
Date:29 Nov 2006



At Wed, 29 Nov 2006 04:43:06 -0800,
Michael Eager wrote:
>
> Simon Kagstrom wrote:
>
> > I've looked in libgcc2.c and am unfortunately a bit unsure about how
> > to get GCC to directly cast an integer value to a float type. For
> > example, I would like to do something like this:
> >
> > float __floatsisf(long i)
> > {
> > return (float)0x40c00000; /* float value 6.0 */
> > }
> >
> > but the cast will of course turn this into some completely different
> > number. Can someone quickly explain how to do this?
>
> Use a union:
>
> union { float f; unsigned int i; } u;
>
> float __floatsisf(long i)
> {
> u.i = 0x40c00000;
> return u.f;
> }

Ah, of course - less magic than I was expecting. :-)

Thanks,
// Simon


© 2004-2008 readlist.com