summaryrefslogtreecommitdiff
path: root/zap/source/any/str/numdig.hh
diff options
context:
space:
mode:
Diffstat (limited to 'zap/source/any/str/numdig.hh')
-rw-r--r--zap/source/any/str/numdig.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/zap/source/any/str/numdig.hh b/zap/source/any/str/numdig.hh
new file mode 100644
index 0000000..65756b9
--- /dev/null
+++ b/zap/source/any/str/numdig.hh
@@ -0,0 +1,12 @@
+#pragma once
+
+namespace zap {
+ namespace impl {
+ template<typename typ> zap_priv_inln inline static auto numdig(typ fmtval,::zap::i8 const bs) noexcept -> ::zap::i8 {
+ ::zap::i8 len = 0x0u;
+ if (fmtval == typ {0x0}) return 0x1u;
+ for (typ val = fmtval;val > 0x0;val /= static_cast<typ>(bs)) ++len;
+ return len;
+ }
+ }
+}