fix log2 typing constraints
add max constant function