hSR

This function returns the higher square root of the given input. It is needed in the initialization step of the VEB tree to calculate the number of children of a given layer. And this is the universe size of the summary of a node. The upper square root is defined by 2^{\lceil(\lg u)/2\rceil}

size_t
hSR
(
size_t value
)

Examples

const size_t currentSeed = unpredictableSeed();
static if(vdebug){write("UT: hSR.              "); writeln("seed: ", currentSeed);} 
rndGenInUse.seed(currentSeed); //initialize the random generator
const size_t M = uniform(1U,size_t.max/2, rndGenInUse); //set universe size to some integer. 
auto hSR = hSR(M); 

assert((hSR & (hSR - 1)) == 0); 
if(hSR < uint.max) assert(hSR >= sqrt(to!float(M)));

const auto check = powersOfTwo.until(hSR).array; 
assert((check[$-1]) * (check[$-1]) < M); 

Meta