File tree Expand file tree Collapse file tree 1 file changed +2
-26
lines changed
Expand file tree Collapse file tree 1 file changed +2
-26
lines changed Original file line number Diff line number Diff line change @@ -20,19 +20,7 @@ public static string Bits(byte value, bool spaces = true)
2020 public static string Bits < T > ( T value , bool spaces = true )
2121 where T : unmanaged
2222 {
23- byte * address = ( byte * ) & value ;
24- int sizeInBytes = sizeof ( T ) ;
25- string result = string . Empty ;
26-
27- while ( sizeInBytes != 0 )
28- {
29- result = result . Insert ( 0 , Bits ( * address , spaces ) + ( spaces ? " " : string . Empty ) ) ;
30-
31- address ++ ;
32- sizeInBytes -- ;
33- }
34-
35- return result ;
23+ return Bits ( & value , sizeof ( T ) , spaces ) ;
3624 }
3725
3826 public static string Bits ( void * ptr , int bytes , bool spaces = true )
@@ -63,19 +51,7 @@ public static string Hex(byte value)
6351 public static string Hex < T > ( T value , bool spaces = true )
6452 where T : unmanaged
6553 {
66- byte * address = ( byte * ) & value ;
67- int iterations = 0 ;
68- string result = string . Empty ;
69-
70- while ( iterations != sizeof ( T ) )
71- {
72- result = result . Insert ( 0 , Hex ( * address ) + ( ( spaces && ( iterations != 0 ) && ( iterations % 2 == 0 ) ) ? " " : string . Empty ) ) ;
73-
74- address ++ ;
75- iterations ++ ;
76- }
77-
78- return result ;
54+ return Hex ( & value , sizeof ( T ) , spaces ) ;
7955 }
8056
8157 public static string Hex ( void * ptr , int bytes , bool spaces = true )
You can’t perform that action at this time.
0 commit comments