mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-16 11:58:05 +02:00
util: add optimised memset64
This just adds a memset64 along the lines of the previously added memset32. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9041>
This commit is contained in:
parent
2ff397c00e
commit
83f0bc5d84
1 changed files with 20 additions and 0 deletions
|
|
@ -45,3 +45,23 @@ util_memset32(void *s, uint32_t ui, size_t n)
|
|||
return s;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void *
|
||||
util_memset64(void *s, uint64_t ui, size_t n)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
|
||||
long d0, d1;
|
||||
__asm__ volatile("rep\n\t"
|
||||
"stosq"
|
||||
: "=&c" (d0), "=&D" (d1)
|
||||
: "a" (ui), "1" (s), "0" (n)
|
||||
: "memory");
|
||||
return s;
|
||||
#else
|
||||
uint64_t *xs = (uint64_t *)s;
|
||||
while (n--)
|
||||
*xs++ = ui;
|
||||
return s;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue