pike.git / src / pike_cpulib.c

version» Context lines:

pike.git/src/pike_cpulib.c:52:    "=r"(cpuid_ptr[1]),    "=d"(cpuid_ptr[2]),    "=c"(cpuid_ptr[3])    : "0"(oper)    : "cc");   #endif /* SIZEOF_CHAR_P == 4 */   #endif /* CL_X86_ASM_STYLE */   }      #endif /* HAVE_IA32_ASM */ +  + /* Same thing as (int)floor(log((double)x) / log(2.0)), except a bit +  quicker. Number of log2 per second: +  +  log(x)/log(2.0) 50,000,000 +  log2(x) 75,000,000 +  Table lookup 3,000,000,000 +  Intrinsic 30,000,000,000,000,000 + */ +  + PMOD_EXPORT int my_log2(UINT64 x) + { +  if( x == 0 ) return 0; +  if(x & ~((UINT64)0xffffffffUL)) { +  return 32 + log2_u32((unsigned INT32)(x>>32)); +  } +  return log2_u32((unsigned INT32)x); + }