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

Function commatize

src/clsparseTimer/clsparseTimer-host.cpp:41–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

PrintMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected