musique/lib/link/include/ableton/mbliterals.hpp

18 lines
335 B
C++
Raw Normal View History

2023-01-06 16:53:58 +01:00
#pragma once
#include <cstdint>
#include <iterator>
#include <numeric>
#include <concepts>
namespace ableton
{
consteval std::int32_t bytes(std::convertible_to<char const*> auto const &array)
{
return std::accumulate(array, array + std::size(array) - 1, std::int32_t(0), [](auto p, auto c)
{
return (p << 8) | c;
});
}
}