|
From: | Richard Henderson |
Subject: | Re: [Qemu-ppc] [Qemu-devel] [PATCH 09/37] libdecnumber: Introduce decNumberFrom[U]Int64 |
Date: | Fri, 18 Apr 2014 11:11:38 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 04/18/2014 07:50 AM, Tom Musta wrote: > + uint64_t unsig; > + if (in >= 0) { > + unsig = in; > + } else { /* negative (possibly BADINT) */ > + if (in == INT64_MIN) { > + unsig = 1ull << 63; /* special case */ > + } else { > + unsig = -in; /* invert */ > + } > + } I know the other code you imported does this but... ug. How about just uint64_t unsig = in; if (in < 0) { unsig = -unsig; } which neatly handles the INT_MIN thing in a defined way. r~
[Prev in Thread] | Current Thread | [Next in Thread] |