On 05/11/2015 10:28, Richard Henderson wrote: > On 11/05/2015 10:25 AM, Paolo Bonzini wrote: >> >> >> On 05/11/2015 10:20, Richard Henderson wrote: >>> >>>> /* Ugly code */ >>>> int64_t scaled = (uint64_t)(int64_t)src << scale; >>> >>> You mean >>> >>> int64_t scaled = (int64_t)((uint64_t)src << scale); >> >> No, that also looks like a typo. >> >> I mean: >> >> - unnecessary cast to int64_t to get the sign extension while avoiding >> the impression of a typo > > Huh. This part doesn't seem a typo to me at all.
A cast _is_ obviously necessary, because src is int32_t and the result is int64_t: int32_t src = rs2 >> (word * 32); int64_t scaled = (uint64_t)src << scale; having uint64_t on the RHS and int64_t on the LHS definitely would be a WTF cause for me. Paolo