We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
log
1 parent 651fcb5 commit 9c59b1aCopy full SHA for 9c59b1a
source/bounded/log.cpp
@@ -22,7 +22,7 @@ import std_module;
22
23
namespace bounded {
24
25
-constexpr auto log_impl(auto value, auto const base) {
+constexpr auto log_impl(auto value, auto const base) -> int {
26
auto sum = 0;
27
while (value >= base) {
28
value /= base;
@@ -31,8 +31,8 @@ constexpr auto log_impl(auto value, auto const base) {
31
return sum;
32
}
33
34
-constexpr auto as_unsigned = [](auto const value) {
35
- return static_cast<numeric_traits::promoted_unsigned<decltype(value)>>(value);
+constexpr auto as_unsigned(auto const value) {
+ return static_cast<numeric_traits::make_unsigned<decltype(value)>>(value);
36
};
37
38
// TODO: It's useful for 0 to return 0, but that's not `log`.
0 commit comments