[PATCH v2] newlib: fix build with <gcc-5 versions

Steven J Abner pheonix.sja@att.net
Sun Mar 20 16:13:54 GMT 2022


I'm probably out of my depth, but along the same question:
Why 0 return and not ((bool)(((unsigned long long)(a) * (b)) >> 32))
or prepend with '!!'?
Steve

 >On 20 Mar 2022 07:52, Eric Bresie wrote:
 >> My C is a little rusty so forgive me up front if I’m not reading 
something quite right…
 >>
 >> Trying to understand the basic logic, the macro is expected to 
return Boolean but the expression is assigning the multiplication 
results to the size and then always returning 0 (false). Is that flow 
correct? Should there be some form of “==“ involved and/or ever 
return non-zero number?

 >it returns a bool to indicate whether there was overflow, but the 
result of the
actual multiplication of the first two operands is stored in the 3rd 
arg.

 >a return value of true means "the value overflowed", not "the 
multiplication
was successful". hence returning false is what the stub should do.





More information about the Newlib mailing list