Skip to content

Commit 7acc5c8

Browse files
committed
Unify the condition form within the asserts
This modificiation affects those conditions which check that a value can be represented with a smaller type. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
1 parent 1938415 commit 7acc5c8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

jerry-core/ecma/base/ecma-helpers-conversion.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
*/
3838
#define ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT(name) \
3939
{ \
40-
JERRY_ASSERT (name[0] == (uint32_t) name[0]); \
41-
JERRY_ASSERT (name[1] == (uint32_t) name[1]); \
42-
JERRY_ASSERT (name[2] == (uint32_t) name[2]); \
43-
JERRY_ASSERT (name[3] == (uint32_t) name[3]); \
40+
JERRY_ASSERT (name[0] <= UINT32_MAX); \
41+
JERRY_ASSERT (name[1] <= UINT32_MAX); \
42+
JERRY_ASSERT (name[2] <= UINT32_MAX); \
43+
JERRY_ASSERT (name[3] <= UINT32_MAX); \
4444
}
4545

4646
/**

jerry-core/ecma/base/ecma-helpers-string.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
/**
4343
* The length should be representable with int32_t.
4444
*/
45-
JERRY_STATIC_ASSERT ((int32_t) ECMA_STRING_MAX_CONCATENATION_LENGTH ==
46-
ECMA_STRING_MAX_CONCATENATION_LENGTH,
45+
JERRY_STATIC_ASSERT (ECMA_STRING_MAX_CONCATENATION_LENGTH <= INT32_MAX,
4746
ECMA_STRING_MAX_CONCATENATION_LENGTH_should_be_representable_with_int32_t);
4847

4948
/**

jerry-core/ecma/builtin-objects/ecma-builtins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
488488
ecma_property_t *routine_desc_prop_p = ecma_create_internal_property (func_obj_p,
489489
ECMA_INTERNAL_PROPERTY_BUILT_IN_ROUTINE_DESC);
490490

491-
JERRY_ASSERT ((uint32_t) packed_value == packed_value);
491+
JERRY_ASSERT (packed_value <= UINT32_MAX);
492492
ecma_set_internal_property_value (routine_desc_prop_p, (uint32_t) packed_value);
493493

494494
return func_obj_p;
@@ -523,7 +523,7 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
523523
uint64_t routine_id_field = JRT_EXTRACT_BIT_FIELD (uint64_t, builtin_routine_desc,
524524
ECMA_BUILTIN_ROUTINE_ID_BUILT_IN_ROUTINE_ID_POS,
525525
ECMA_BUILTIN_ROUTINE_ID_BUILT_IN_ROUTINE_ID_WIDTH);
526-
JERRY_ASSERT ((uint16_t) routine_id_field == routine_id_field);
526+
JERRY_ASSERT (routine_id_field <= UINT16_MAX);
527527

528528
ecma_builtin_id_t built_in_id = (ecma_builtin_id_t) built_in_id_field;
529529
uint16_t routine_id = (uint16_t) routine_id_field;

0 commit comments

Comments
 (0)