Files
rk35xx-android14/external/ltp/testcases/open_posix_testsuite/include/mem_pattern.h
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

36 lines
652 B
C

/*
* Copyright (c) 2012 Cyril Hrubis <chrubis@suse.cz>
*
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*/
/*
* Function to fill mem with reasonably complicated pattern and function
* that checks that pattern is correct.
*/
static void fill_mem(void *dst, size_t size)
{
unsigned char *ptr = dst;
while (--size > 0) {
*ptr = (size % 256) ^ 0x42;
ptr++;
}
}
static int check_mem(void *src, size_t size)
{
unsigned char *ptr = src;
while (--size > 0) {
if (*ptr != ((size % 256) ^ 0x42))
return 1;
ptr++;
}
return 0;
}