summaryrefslogtreecommitdiff
path: root/lib/pixman/test/utils.h
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2011-07-24 13:05:48 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2011-07-24 13:05:48 +0000
commit33848ac2d5208b6bdd297b636ee61f972982d17b (patch)
tree38a6092e925c775e108e18f3c52ebd20d092239e /lib/pixman/test/utils.h
parentd1c54fd892ab7ed02443d2af0b01936b425d7e2c (diff)
Update to pixman 0.22.2.
0.22.0 was tested by many. 0.22.2 only add a few bug fixes. Note that on amd64 a recent ld.so is needed to avoid random bus errors.
Diffstat (limited to 'lib/pixman/test/utils.h')
-rw-r--r--lib/pixman/test/utils.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/pixman/test/utils.h b/lib/pixman/test/utils.h
index e7920f007..615ad7841 100644
--- a/lib/pixman/test/utils.h
+++ b/lib/pixman/test/utils.h
@@ -3,6 +3,8 @@
#include <assert.h>
#include "pixman-private.h" /* For 'inline' definition */
+#define ARRAY_LENGTH(A) ((int) (sizeof (A) / sizeof ((A) [0])))
+
/* A primitive pseudorandom number generator,
* taken from POSIX.1-2001 example
*/
@@ -39,6 +41,15 @@ lcg_rand_N (int max)
return (lo | hi) % max;
}
+static inline uint32_t
+lcg_rand_u32 (void)
+{
+ uint32_t lo = lcg_rand();
+ uint32_t hi = lcg_rand();
+
+ return (hi << 16) | lo;
+}
+
/* CRC 32 computation
*/
uint32_t
@@ -49,13 +60,13 @@ compute_crc32 (uint32_t in_crc32,
/* perform endian conversion of pixel data
*/
void
-image_endian_swap (pixman_image_t *img, int bpp);
+image_endian_swap (pixman_image_t *img);
/* Allocate memory that is bounded by protected pages,
* so that out-of-bounds access will cause segfaults
*/
void *
-fence_malloc (uint32_t len);
+fence_malloc (int64_t len);
void
fence_free (void *data);
@@ -68,6 +79,9 @@ make_random_bytes (int n_bytes);
double
gettime (void);
+uint32_t
+get_random_seed (void);
+
/* main body of the fuzzer test */
int
fuzzer_test_main (const char *test_name,
@@ -80,6 +94,9 @@ fuzzer_test_main (const char *test_name,
void
fail_after (int seconds, const char *msg);
+/* If possible, enable traps for floating point exceptions */
+void enable_fp_exceptions(void);
+
/* A pair of macros which can help to detect corruption of
* floating point registers after a function call. This may
* happen if _mm_empty() call is forgotten in MMX/SSE2 fast
@@ -118,3 +135,6 @@ fail_after (int seconds, const char *msg);
/* Try to get an aligned memory chunk */
void *
aligned_malloc (size_t align, size_t size);
+
+void
+initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb);