MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / commatize

Function commatize

src/statTimer/statisticalTimer.CPU.cpp:40–61  ·  view source on GitHub ↗

T could be 32-bit or 64-bit

Source from the content-addressed store, hash-verified

38//
39template< typename T > // T could be 32-bit or 64-bit
40std::basic_string<TCHAR> commatize (T number)
41{
42 static TCHAR scratch [8*sizeof(T)];
43
44 register TCHAR * ptr = scratch + countOf( scratch );
45 *(--ptr) = 0;
46
47 for (int digits = 3; ; )
48 {
49 *(--ptr) = '0' + int (number % 10);
50 number /= 10;
51 if (0 == number)
52 break;
53 if (--digits <= 0)
54 {
55 *(--ptr) = ',';
56 digits = 3;
57 }
58 }
59
60 return std::basic_string<TCHAR> (ptr);
61}
62
63// Functor object to help with accumulating values in vectors
64template< typename T >

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected