Changeset 3f3514aa in mainline


Ignore:
Timestamp:
2018-07-05T21:41:22Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
08be4a4
Parents:
2fe861d
git-author:
Dzejrou <dzejrou@…> (2018-05-02 17:32:27)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:22)
Message:

cpp: made builtin wrappers constexpr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/internal/builtins.hpp

    r2fe861d r3f3514aa  
    4242 */
    4343
     44#include <cstdlib>
     45
    4446namespace std::aux
    4547{
    4648    template<class T>
    47     double log2(T val)
     49    constexpr double log2(T val)
    4850    {
    4951        return __builtin_log2(static_cast<double>(val));
     
    5153
    5254    template<class T>
    53     double pow2(T exp)
     55    constexpr double pow2(T exp)
    5456    {
    55         return __builtin_pow(2.0, static_cast<double>(val));
     57        return __builtin_pow(2.0, static_cast<double>(exp));
    5658    }
    5759
    5860    template<class T>
    59     double ceil(T val)
     61    constexpr size_t pow2u(T exp)
     62    {
     63        return static_cast<size_t>(pow2(exp));
     64    }
     65
     66    template<class T>
     67    constexpr double ceil(T val)
    6068    {
    6169        return __builtin_ceil(static_cast<double>(val));
Note: See TracChangeset for help on using the changeset viewer.