/*******************************************************************************
 *
 * File:     math.hpp
 *
 * Contents: Math helpers.
 *
 * Copyright 2017
 *
 * Author: David Juhasz (david.juhasz@tuwien.ac.at)
 *
 ******************************************************************************/

#ifndef ROSA_SUPPORT_MATH_HPP
#define ROSA_SUPPORT_MATH_HPP

#include <cstdlib>

namespace rosa {

// Computes log base 2 of an integer as a constexpr.
constexpr size_t log2(const size_t N) {
  return ((N < 2) ? 1 : 1 + log2(N / 2));
}

} // End namespace rosa

#endif // ROSA_SUPPORT_MATH_HPP

