Optimize ecma_number_to_uint32 (#3470)
The ecma_number_to_uint32 function is called many times, we can merge ecma_number_is_nan and ecma_number_is_infinity checks to !ecma_number_is_finite to let the compiler generate more optimal code for it. JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
committed by
Robert Fancsik
parent
8cb2be6001
commit
518fcf2c6a
@@ -703,9 +703,7 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */
|
||||
uint32_t
|
||||
ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
|
||||
{
|
||||
if (ecma_number_is_nan (num)
|
||||
|| ecma_number_is_zero (num)
|
||||
|| ecma_number_is_infinity (num))
|
||||
if (JERRY_UNLIKELY (ecma_number_is_zero (num) || !ecma_number_is_finite (num)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user