42 template<
typename T >
54 template<
typename T >
59 template<
typename T , u
int32_t WIDTH >
62 uint32_t lSize (
sizeof ( T ) << 3 );
63 aStr.write (
"0b" , 2 );
64 int32_t i ( WIDTH-lSize );
76 lMask <<= ( lSize-1 );
78 for ( uint32_t i=0 ; i!=lSize ; ++i )
80 aStr.put ( ( lValue & lMask ) ?
'1':
'0' );
86 template<
typename T , u
int32_t WIDTH >
89 static const char* lCharacterMapping (
"9876543210123456789" );
90 static const char* lCharacterMappingCenter ( lCharacterMapping + 9 );
101 *lPtr++ = * ( lCharacterMappingCenter + tmp_value - ( value * 10 ) );
105 int32_t i ( WIDTH- ( lPtr-lBuffer ) );
117 aStr.put ( * ( --lPtr ) );
119 while ( lPtr!=lBuffer );
123 template<
typename T , u
int32_t WIDTH >
126 uint32_t lSize (
sizeof ( T ) << 1 );
127 static const char* lCharacterMapping (
"0123456789ABCDEF" );
128 aStr.write (
"0x" , 2 );
129 int32_t i ( WIDTH-lSize );
140 uint8_t* lPtr ( lStart +
sizeof ( T ) );
145 aStr.put ( * ( lCharacterMapping + ( ( ( *lPtr ) &0xF0 ) >>4 ) ) );
146 aStr.put ( * ( lCharacterMapping + ( ( ( *lPtr ) &0x0F ) ) ) );
148 while ( lPtr!=lStart );
154 template<
typename T , u
int32_t WIDTH >
159 aStr.write (
"0b0" , 3 );
163 uint32_t lSize (
sizeof ( T ) <<3 );
164 aStr.write (
"0b" , 2 );
167 lMask <<= ( lSize-1 );
168 bool lPrint (
false );
169 bool lCurrent (
false );
171 for ( uint32_t i=0 ; i!=lSize ; ++i )
173 lCurrent = lValue & lMask;
175 if ( (lPrint |= lCurrent) )
177 aStr.put ( lCurrent?
'1':
'0' );
187 template<
typename T , u
int32_t WIDTH >
190 static const char* lCharacterMapping (
"9876543210123456789" );
191 static const char* lCharacterMappingCenter ( lCharacterMapping + 9 );
193 char* lPtr = lBuffer;
202 *lPtr++ = * ( lCharacterMappingCenter + tmp_value - ( value * 10 ) );
208 aStr.put ( * ( --lPtr ) );
210 while ( lPtr!=lBuffer );
215 template<
typename T , u
int32_t WIDTH >
218 static const char* lCharacterMapping (
"0123456789ABCDEF" );
222 aStr.write (
"0x0" , 3 );
226 uint32_t lSize (
sizeof ( T ) );
227 aStr.write (
"0x" , 2 );
228 bool lPrint (
false );
231 uint8_t* lPtr ( lStart + lSize );
236 lPos = ( ( ( *lPtr ) &0xF0 ) >>4 );
238 if ( (lPrint |= (
bool ) ( lPos )) )
240 aStr.put ( * ( lCharacterMapping + lPos ) );
243 lPos = ( ( *lPtr ) &0x0F );
245 if ( (lPrint |= (
bool ) ( lPos )) )
247 aStr.put ( * ( lCharacterMapping + lPos ) );
250 while ( lPtr!=lStart );
256 template<
typename FORMAT >
263 template<
typename FORMAT >
270 template<
typename FORMAT >
277 template<
typename FORMAT >
284 template<
typename FORMAT >
291 template<
typename FORMAT >
298 template<
typename FORMAT >
305 template<
typename FORMAT >
312 #if __SIZEOF_LONG__ == 4
313 template<
typename FORMAT >
322 template<
typename FORMAT >