#ifndef Morpheo_Log2_h
#define Morpheo_Log2_h

/*
 * $Id: Log2.h 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ Description ]
 * 
 */

#include <stdint.h>
#include <math.h>

namespace morpheo              {

  inline uint32_t log2 (uint32_t value)
  {
    return static_cast<uint32_t>(ceil(::log2(value)));
  }

  inline bool is_log2 (uint32_t value)
  {
    return (value == static_cast<uint32_t>((1<<(morpheo::log2(value)))));
  }

}; // end namespace morpheo              

#endif
