Dyn

 view release on metacpan or  search on metacpan

dyncall/test/call_suite_aggrs/globals.c  view on Meta::CPAN

#undef X

/* intentional misalignment of test aggregates (use only positive numbers);
 * crashes/exceptions (e.g. sigbus on some platforms) when using values > 0
 * might reveal missing aggr-by-val copies in the implementation */
#define AGGR_MISALIGN 1 /* @@@AGGR make configurable */

static double rand_d()      { return ( ( (double) rand() )  / ( (double) RAND_MAX ) ); }

/* fill mem with random values, make sure no float aligned memory location
 * results in a NaN, as they always compare to false; so avaid all ones in
 * exporent (for simplicity we just look at first 7 exponent bits and make sure
 * they aren't all set, which would work for all IEEE754 precision formats) */
static void rand_mem__fp_friendly(void* p, size_t s)
{
  int i;
  for(i = 0; i<s; ++i) {
    char* c = (char*)p;
    c[i] = (char)rand(); /* slowish, byte by byte, but whatev */
    if((c[i]&0x7f) == 0x7f)
      c[i] ^= 1;

dyncall/test/callback_suite_aggrs/globals.c  view on Meta::CPAN

#undef X

/* intentional misalignment of test aggregates (use only positive numbers);
 * crashes/exceptions (e.g. sigbus on some platforms) when using values > 0
 * might reveal missing aggr-by-val copies in the implementation */
#define AGGR_MISALIGN 1 /* @@@AGGR make configurable */

static double rand_d()      { return ( ( (double) rand() )  / ( (double) RAND_MAX ) ); }

/* fill mem with random values, make sure no float aligned memory location
 * results in a NaN, as they always compare to false; so avaid all ones in
 * exporent (for simplicity we just look at first 7 exponent bits and make sure
 * they aren't all set, which would work for all IEEE754 precision formats) */
static void rand_mem__fp_friendly(void* p, size_t s)
{
  int i;
  for(i = 0; i<s; ++i) {
    char* c = (char*)p;
    c[i] = (char)rand(); /* slowish, byte by byte, but whatev */
    if((c[i]&0x7f) == 0x7f)
      c[i] ^= 1;



( run in 0.244 second using v1.01-cache-2.11-cpan-4d50c553e7e )