| * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. |
| * SPDX-License-Identifier: BSD-3-Clause |
| void *memset(void *dst, int val, size_t count) |
| uint64_t fill = (unsigned char)val; |
| /* Simplify code below by making sure we write at least one byte. */ |
| /* Handle the first part, until the pointer becomes 64-bit aligned. */ |
| while (((uintptr_t)ptr & 7U) != 0U) { |
| /* Duplicate the fill byte to the rest of the 64-bit word. */ |
| /* Use 64-bit writes for as long as possible. */ |
| for (; count >= 8U; count -= 8) { |
| /* Handle the remaining part byte-per-byte. */ |