commit 6db0f1960518ec690b80fe61289f3ced4a0db55e
parent c2ed0b6bbb27ddec8e19bd5b064caa1d541755de
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 29 Jun 2016 10:57:35 +0200
Move the rand_canonic function in the test utilities
Diffstat:
3 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/src/test_s2d_primitive.c b/src/test_s2d_primitive.c
@@ -33,14 +33,6 @@
#define NSAMPS 4096
-static float
-rand_canonic(void)
-{
- int r;
- while((r = rand()) == RAND_MAX);
- return (float)r / (float)RAND_MAX;
-}
-
int
main(int argc, char** argv)
{
diff --git a/src/test_s2d_sample.c b/src/test_s2d_sample.c
@@ -33,14 +33,6 @@
#define NSAMPS 4096
-static float
-rand_canonic(void)
-{
- int r;
- while((r = rand()) == RAND_MAX);
- return (float)r / (float)RAND_MAX;
-}
-
int
main(int argc, char** argv)
{
diff --git a/src/test_s2d_utils.h b/src/test_s2d_utils.h
@@ -81,7 +81,15 @@ line_segments_get_position(const unsigned ivert, float position[2], void* data)
/*******************************************************************************
* Miscellaneous function
******************************************************************************/
-static void
+static INLINE float
+rand_canonic(void)
+{
+ int r;
+ while((r = rand()) == RAND_MAX);
+ return (float)r / (float)RAND_MAX;
+}
+
+static INLINE void
check_memory_allocator(struct mem_allocator* allocator)
{
if(MEM_ALLOCATED_SIZE(allocator)) {