diff --git a/tests/suites/test_suite_alignment.function b/tests/suites/test_suite_alignment.function index 3a5038e98c..b027c4b116 100644 --- a/tests/suites/test_suite_alignment.function +++ b/tests/suites/test_suite_alignment.function @@ -20,13 +20,8 @@ int parse_hex_string(char *hex_string, uint64_t *result) /* If < 8 bytes, shift right and pad with leading zeros for big-endian */ if (MBEDTLS_IS_BIG_ENDIAN && olen < 8) { - int offset = 8 - olen; - for (int i = olen - 1; i >= 0; i--) { - raw[i + offset] = raw[i]; - } - for (int i = 0; i < offset; i++) { - raw[i] = 0; - } + memmove(raw + 8 - olen, raw, olen); + memset(raw, 0, 8 - olen); } *result = 0;