MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AddCommas

Function AddCommas

tensorflow/core/summary/loader.cc:30–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template <typename T>
30string AddCommas(T n) {
31 static_assert(std::is_integral<T>::value, "is_integral");
32 string s = strings::StrCat(n);
33 if (s.size() > 3) {
34 int extra = s.size() / 3 - (s.size() % 3 == 0 ? 1 : 0);
35 s.append(extra, 'X');
36 int c = 0;
37 for (int i = s.size() - 1; i > 0; --i) {
38 s[i] = s[i - extra];
39 if (++c % 3 == 0) {
40 s[--i] = ',';
41 --extra;
42 }
43 }
44 }
45 return s;
46}
47
48int main(int argc, char* argv[]) {
49 string path;

Callers 1

mainFunction · 0.85

Calls 3

StrCatFunction · 0.50
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected