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

Function commatize

src/clsparseTimer/clsparseTimer-device.cpp:32–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30//
31namespace {
32 std::string commatize( cl_ulong number )
33 {
34 static char scratch[ 8 * sizeof( cl_ulong ) ];
35
36 char* ptr = scratch + sizeof( 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::string{ ptr };
53 }
54
55 // Functor object to help with accumulating values in vectors
56 template< typename T >

Callers 1

PrintMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected