Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (c) 2012 Cyril Hrubis <chrubis (at) suse.cz>
      3  *
      4  * This file is licensed under the GPL license.  For the full content
      5  * of this license, see the COPYING file at the top level of this
      6  * source tree.
      7  */
      8 
      9 /*
     10  * Function to fill mem with reasonably complicated pattern and function
     11  * that checks that pattern is correct.
     12  */
     13 
     14 static void fill_mem(void *dst, size_t size)
     15 {
     16 	unsigned char *ptr = dst;
     17 
     18 	while (--size > 0) {
     19 		*ptr = (size % 256) ^ 0x42;
     20 		ptr++;
     21 	}
     22 }
     23 
     24 static int check_mem(void *src, size_t size)
     25 {
     26 	unsigned char *ptr = src;
     27 
     28 	while (--size > 0) {
     29 		if (*ptr != ((size % 256) ^ 0x42))
     30 			return 1;
     31 		ptr++;
     32 	}
     33 
     34 	return 0;
     35 }
     36