5 // Copyright (c) 2011 Apple Inc.
8 #ifndef BulletTest_Utils_h
9 #define BulletTest_Utils_h
11 #include "btIntDefines.h"
19 #define LARGE_FLOAT17 (1.f * powf(2,17))
20 #define RANDF_16 (random_number32() * powf(2,-16))
21 #define RANDF_01 ( random_number32() * powf(2,-32) )
22 #define RANDF ( random_number32() * powf(2,-8) )
23 #define RANDF_m1p1 (2.0f*( random_number32() * powf(2,-32)-1.0f))
25 #define LARGE_FLOAT17 (0x1.0p17f)
26 #define RANDF_16 (random_number32() * 0x1.0p-16f)
27 #define RANDF_01 ( random_number32() * 0x1.0p-32f )
28 #define RANDF ( random_number32() * 0x1.0p-8f )
29 #define RANDF_m1p1 (2.0f*( random_number32() * 0x1.0p-32f )-1.0f)
37 /*********************
39 *********************/
40 extern int gReportNanoseconds;
42 uint64_t ReadTicks( void );
43 double TicksToCycles( uint64_t delta ); // Performance data should be reported in cycles most of the time.
44 double TicksToSeconds( uint64_t delta );
47 /*********************
49 *********************/
50 // return buffer containing count objects of size size, with guard pages in betweeen.
51 // The stride between one object and the next is given by objectStride.
52 // objectStride may be NULL. Objects so created are freed with GuardFree
53 void *GuardCalloc( size_t count, size_t size, size_t *objectStride );
54 void GuardFree( void * );
55 // mark the contents of a guard buffer read-only or write-only. Return 0 on success.
56 int GuardMarkReadOnly( void *);
57 int GuardMarkWriteOnly( void *);
58 int GuardMarkReadWrite( void *);
60 /*********************
62 *********************/
63 #define vlog( ... ) printf( __VA_ARGS__ )
64 uint32_t random_number32(void);
65 uint64_t random_number64(void);