24RCSIDH(math_h, 
"$Id: b7b755087d6daab1d81f5beb6d589f1744729406 $")
 
   34#ifdef HAVE_BUILTIN_CLZLL 
   36        return 1ULL << (64 - __builtin_clzll(v - 1));
 
 
   57#ifdef HAVE_BUILTIN_CLZLL 
   58        uv = (uint64_t)(v - 1);
 
   61                int shift = 64 - __builtin_clzll(uv);
 
   67                return (int64_t)(1ULL << shift);
 
   81        if (uv > (uint64_t)INT64_MAX) {
 
 
   96        if (num == 0) 
return 0; 
 
   98#ifdef HAVE_BUILTIN_CLZLL 
   99        return (64 - __builtin_clzll(num));
 
  102        while (num >>= 1) ret++;
 
 
  115        if (num == 0) 
return 0;
 
  117#ifdef HAVE_BUILTIN_CLZLL 
  118        return __builtin_ctzll(num) + 1;
 
  123                if (num & 0x01) 
break;
 
 
  138        static uint64_t 
const pow_of_10[] =
 
  156                10000000000000000ULL,
 
  157                100000000000000000ULL,
 
  158                1000000000000000000ULL,
 
  159                10000000000000000000ULL
 
  164        return tmp - (num < pow_of_10[tmp]);
 
 
  176#define fr_multiply(_out, _a, _b) !__builtin_mul_overflow(_a, _b, _out) 
  187#define fr_add(_out, _a, _b) !__builtin_add_overflow(_a, _b, _out) 
  198#define fr_sub(_out, _a, _b) !__builtin_sub_overflow(_a, _b, _out) 
  202#define ROUND_UP_POW2(_num, _mul)       (((_num) + ((_mul) - 1)) & ~((_mul) - 1)) 
  206#define ROUND_UP(_num, _mul)            (((((_num) + ((_mul) - 1))) / (_mul)) * (_mul)) 
  211#define ROUND_UP_DIV(_x, _y)            (1 + (((_x) - 1) / (_y))) 
static uint64_t fr_roundup_pow2_uint64(uint64_t v)
static int64_t fr_roundup_pow2_int64(int64_t v)
static uint8_t fr_low_bit_pos(uint64_t num)
Find the lowest order high bit in an unsigned 64 bit integer.
static uint8_t fr_log10(uint64_t num)
Efficient calculation of log10 of a unsigned 64bit integer.
static uint8_t fr_high_bit_pos(uint64_t num)
Find the highest order high bit in an unsigned 64 bit integer.