Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/base/ecma-helpers-conversion.c (C)

Code before:
#define NUMBER_MAX_DECIMAL_EXPONENT 308
/**
 * Number.MIN_VALUE exponent part when using 64 bit float representation.
 */
#define NUMBER_MIN_DECIMAL_EXPONENT -324

#elif !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)

/**
 * Number.MAX_VALUE exponent part when using 32 bit float representation.
 */
#define NUMBER_MAX_DECIMAL_EXPONENT 38
/**
 * Number.MIN_VALUE exponent part when using 32 bit float representation.
 */
#define NUMBER_MIN_DECIMAL_EXPONENT -45

#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */

/**
 * Value of epsilon
 */
#define EPSILON 0.0000001

/**
 * it's a constant that check ecma_utf8_string_to_number_by_radix radix arguments
 */
#define ALLOW_UNDERSCORE 0x1

/**
 * ECMA-defined conversion from string to number for different radixes (2, 8, 16).
 *
 * See also:
 *          ECMA-262 v5 9.3.1
 *          ECMA-262 v6 7.1.3.1
 *
 * @return NaN - if the conversion fails
 *         converted number - otherwise
 */
static ecma_number_t
ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 string */
                                     const lit_utf8_byte_t *end_p, /**< end of utf-8 string  */
                                     uint32_t radix) /**< radix */
{
#if ENABLED (JERRY_ESNEXT)
  bool allow_underscore = (radix & ALLOW_UNDERSCORE);
#endif /* ENABLED (JERRY_ESNEXT) */
  radix &= (uint32_t) ~ALLOW_UNDERSCORE;
  JERRY_ASSERT (radix == 2 || radix == 8 || radix == 16);

  ecma_number_t num = ECMA_NUMBER_ZERO;

Review comment (suggestion):
Comment: `Underscore is ignored when this option is passed.`

I know the names above does not follow the syntax (they are very old), but please rename
ALLOW_UNDERSCORE -> ECMA_CONVERSION_ALLOW_UNDERSCORE

Code after:
#define NUMBER_MAX_DECIMAL_EXPONENT 308
/**
 * Number.MIN_VALUE exponent part when using 64 bit float representation.
 */
#define NUMBER_MIN_DECIMAL_EXPONENT -324

#elif !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)

/**
 * Number.MAX_VALUE exponent part when using 32 bit float representation.
 */
#define NUMBER_MAX_DECIMAL_EXPONENT 38
/**
 * Number.MIN_VALUE exponent part when using 32 bit float representation.
 */
#define NUMBER_MIN_DECIMAL_EXPONENT -45

#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */

/**
 * Value of epsilon
 */
#define EPSILON 0.0000001

/**
 * ECMA-defined conversion from string to number for different radixes (2, 8, 16).
 *
 * See also:
 *          ECMA-262 v5 9.3.1
 *          ECMA-262 v6 7.1.3.1
 *
 * @return NaN - if the conversion fails
 *         converted number - otherwise
 */
static ecma_number_t
ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 string */
                                     const lit_utf8_byte_t *end_p, /**< end of utf-8 string  */
                                     uint32_t radix) /**< radix */
{
#if ENABLED (JERRY_ESNEXT)
  bool allow_underscore = (radix & ECMA_CONVERSION_ALLOW_UNDERSCORE);
  radix &= (uint32_t) ~ECMA_CONVERSION_ALLOW_UNDERSCORE;
#endif /* ENABLED (JERRY_ESNEXT) */
  JERRY_ASSERT (radix == 2 || radix == 8 || radix == 16);

  ecma_number_t num = ECMA_NUMBER_ZERO;

#if ENABLED (JERRY_ESNEXT)
  if (radix <= 8)
  {
    lit_code_point_t upper_limit = LIT_CHAR_0 + radix;