Branch: Tag:

2016-04-20

2016-04-20 10:25:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stuff: Support 64 bit integers in my_log2().

Fixes some issues with random() on values larger than 32 bits.

75:    Intrinsic 30,000,000,000,000,000   */    - PMOD_EXPORT int my_log2(size_t x) + PMOD_EXPORT int my_log2(UINT64 x)   {    if( x == 0 ) return 0; -  return log2_u32(x); +  if(x & ~((UINT64)0xffffffffUL)) { +  return 32 + log2_u32((unsigned INT32)(x>>32));    } -  +  return log2_u32((unsigned INT32)x); + }         PMOD_EXPORT double my_strtod(char *nptr, char **endptr)