]> sourceware.org Git - newlib-cygwin.git/commit
Change the return type of converttoint and document the semantics
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 4 Jul 2018 10:09:39 +0000 (11:09 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 6 Jul 2018 08:29:01 +0000 (10:29 +0200)
commit6a85e1a4e5a01dec3b423eb172b3ad9155487e75
treea68b9138d3766fb649dedf51f14c8e7618236755
parent73a3e95ff2b08c61f2a046ffc543ae6eee589b03
Change the return type of converttoint and document the semantics

The roundtoint and converttoint internal functions are only called with small
values, so 32 bit result is enough for converttoint and it is a signed int
conversion so the natural return type is int32_t.

The original idea was to help the compiler keeping the result in uint64_t,
then it's clear that no sign extension is needed and there is no accidental
undefined or implementation defined signed int arithmetics.

But it turns out gcc does a good job with inlining so changing the type has
no overhead and the semantics of the conversion is less surprising this way.
Since we want to allow the asuint64 (x + 0x1.8p52) style conversion, the top
bits were never usable and the existing code ensures that only the bottom
32 bits of the conversion result are used.

In newlib with default settings only aarch64 is affected and there is no
significant code generation change with gcc after the patch.
newlib/libm/common/math_config.h
This page took 0.032511 seconds and 5 git commands to generate.