This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private T ReadEnum<T>(int size) | |
{ | |
switch (size) | |
{ | |
case 1: | |
return (T)Enum.ToObject(typeof(T), reader.ReadByte()); | |
case 2: | |
return (T)Enum.ToObject(typeof(T), reader.ReadInt16()); | |
case 4: | |
return (T)Enum.ToObject(typeof(T), reader.ReadInt32()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//winner x64 | |
private static void WriteInt64E(long y, byte[] buf, int offset) | |
{ | |
if (y < 0) | |
{ | |
y = -y; | |
buf[offset] = (byte)y; | |
buf[offset + 1] = (byte)(y >>= 8); | |
buf[offset + 2] = (byte)(y >>= 8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Text Compare | |
Produced: 7/22/2014 10:14:10 AM | |
Mode: All | |
Left file: C:\Users\\Desktop\old_Write64_JIT_loop.txt | |
Right file: C:\Users\\Desktop\new_Write64_JIT_loop.txt | |
1 for (int byteIndex = 0; byteIndex < 8; byteIndex++) <> 1 for (int i = -1; ++i < 8; value >>= 8) | |
2 00007FFC28EE471D mov dword ptr [rsp+28h],0 2 00007FFC28EE4911 mov dword ptr [rsp+20h],0FFFFFFFFh | |
3 00007FFC28EE4725 jmp 00007FFC28EE4825 3 00007FFC28EE4919 jmp 00007FFC28EE4972 | |
4 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Text Compare | |
Produced: 7/22/2014 10:17:01 AM | |
Mode: All | |
Left file: C:\Users\\Desktop\old_Write64_JIT.txt | |
Right file: C:\Users\\Desktop\new_Write64_JIT.txt | |
<> 1 if (value < 0) | |
1 00007FFC28EE46B0 mov dword ptr [rsp+18h],r8d 2 00007FFC28EE48C0 mov dword ptr [rsp+18h],r8d | |
2 00007FFC28EE46B5 mov qword ptr [rsp+10h],rdx 3 00007FFC28EE48C5 mov qword ptr [rsp+10h],rdx | |
3 00007FFC28EE46BA mov qword ptr [rsp+8],rcx 4 00007FFC28EE48CA mov qword ptr [rsp+8],rcx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Text Compare | |
Produced: 7/22/2014 10:02:39 AM | |
Mode: All | |
Left file: C:\Users\\Desktop\old_Write64.txt Right file: C:\Users\\Desktop\new_Write64.txt | |
1 .method private hidebysig static = 1 .method private hidebysig static | |
2 void WriteInt64 ( 2 void WriteInt64 ( | |
3 int64 'value', 3 int64 'value', | |
4 uint8[] buf, 4 uint8[] buf, | |
5 int32 offset 5 int32 offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strTest = "The quick brown fox jumps over the lazy dog"; | |
var bufTest = Encoding.Default.GetBytes(strTest); | |
using (var msBufTest = new MemoryStream(bufTest)) | |
{ | |
var compressedBytes = Zlib.Compress(msBufTest); | |
using (var msCompressedBytes = new MemoryStream(compressedBytes)) | |
{ | |
var decompressedBytes = Zlib.Decompress(msCompressedBytes, (uint)compressedBytes.Length); | |
var strDecompressed = Encoding.Default.GetString(decompressedBytes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Record : IEnumerable<Record> { | |
public byte[] ID; | |
public uint Size; | |
private List<Record> _children = new List(); | |
public Record(some data source) { | |
ID = read ID; | |
Size = read Size; | |
_children = read children; |
NewerOlder