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

Function commatize

src/statTimer/statisticalTimer.GPU.cpp:32–53  ·  view source on GitHub ↗

T could be 32-bit or 64-bit

Source from the content-addressed store, hash-verified

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

Callers 1

PrintMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected