Re: [RFC][13/19] Target FP: Perform Ada fixed-point scaling in target format

Ulrich Weigand
2017-10-09T16:58:38Z

Joel Brobecker wrote:
> On Tue, Sep 05, 2017 at 08:21:35PM +0200, Ulrich Weigand wrote:
> > * ada-lang.c (cast_to_fixed): Reimplement in target arithmetic.
> > (cast_to_fixed): Likewise.
> ^^^^^^^^^^^^^
> cast_from_fixed :)
Fixed.

> > (ada_scaling_type): New function.
> > (ada_delta): Return value instead of DOUBLEST. Perform target
> > arithmetic instead of host arithmetic.
> > (scaling_factor): Rename to ...
> > (ada_scaling_factor) ... this. Return value instead of DOUBLEST.
> > Perform target arithmetic instead of host arithmetic.
>
> Maybe mention that we are making this function non-static too?
Fixed.

> We have a fixed point tests in the testsuite (gdb.ada/fixed_points.exp),
> so having it run and pass after your change should be a very good sanity
> check on its own.

I did run the test suite including Ada tests on x86_64-linux, and this
test case does still pass.

> This is a C++ question, really. Does it make any difference if you
> declare the std::string first, and then only set its contents in
> a second statement? I can't remember the details, but it has to do
> with initialization vs assignment. I _really_ hope that the string
> class is sufficiently well designed that the two are really equivalent
> in practice?

Huh. Indeed I see worse code when doing the assignment as a separate
statement, at least with GCC 4.8. I'll make sure to use initialization
instead wherever possible. Thanks for pointing this out!

Thanks for the review!

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com