summaryrefslogtreecommitdiff
path: root/zap/source/any/str/numdig.hh
blob: ea36f0bb180fcf24dcd7566a8b7fb25db9e078f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once

namespace zap {
	namespace impl {
		template<typename typ> zap_attr_iln 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;
		}
	}
}