distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
log2u.hpp File Reference

log2u() header More...

#include <climits>
Include dependency graph for log2u.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 estd
 Collection of useful templates.
 

Macros

#define STATIC_ASSERT(...)   static_assert(__VA_ARGS__, #__VA_ARGS__)
 Produces a static_assert() where the expression is also used as the message. More...
 

Functions

constexpr int estd::log2u (const unsigned int value)
 log2()-like constexpr function for unsigned int. More...
 
 estd::STATIC_ASSERT (log2u(0)==0)
 
 estd::STATIC_ASSERT (log2u(1)==0)
 
 estd::STATIC_ASSERT (log2u(2)==1)
 
 estd::STATIC_ASSERT (log2u(4)==2)
 
 estd::STATIC_ASSERT (log2u(8)==3)
 
 estd::STATIC_ASSERT (log2u(15)==3)
 
 estd::STATIC_ASSERT (log2u(16)==4)
 
 estd::STATIC_ASSERT (log2u(17)==4)
 
 estd::STATIC_ASSERT (log2u(127)==6)
 
 estd::STATIC_ASSERT (log2u(128)==7)
 
 estd::STATIC_ASSERT (log2u(129)==7)
 
 estd::STATIC_ASSERT (log2u(UINT_MAX)==sizeof(UINT_MAX) *CHAR_BIT - 1)
 

Detailed Description

log2u() header

Author
Copyright (C) 2019 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
License
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Macro Definition Documentation

◆ STATIC_ASSERT

#define STATIC_ASSERT (   ...)    static_assert(__VA_ARGS__, #__VA_ARGS__)

Produces a static_assert() where the expression is also used as the message.

Parameters
[in]<strong>VA_ARGS</strong>is the expression that will be tested, which will also be used as the message