mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-20 07:45:16 +00:00
Fix last couple of commits
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SabreTools.Data.Extensions
|
||||
{
|
||||
public static class XZ
|
||||
@@ -17,15 +19,15 @@ namespace SabreTools.Data.Extensions
|
||||
if (maxSize > 9)
|
||||
maxSize = 9;
|
||||
|
||||
ulong output = value[0] & 0x7F;
|
||||
ulong output = (ulong)(value[0] & 0x7F);
|
||||
int i = 0;
|
||||
|
||||
while (value[i++] & 0x80 != 0)
|
||||
while ((value[i++] & 0x80) != 0)
|
||||
{
|
||||
if (i >= maxSize || value[i] == 0x00)
|
||||
return 0;
|
||||
|
||||
output |= (value[i] & 0x7F) << (i * 7);
|
||||
output |= (ulong)(value[i] & 0x7F) << (i * 7);
|
||||
}
|
||||
|
||||
return output;
|
||||
@@ -44,10 +46,9 @@ namespace SabreTools.Data.Extensions
|
||||
|
||||
var output = new List<byte>();
|
||||
|
||||
int i = 0;
|
||||
while (value >= 0x80)
|
||||
{
|
||||
output.Add((byte)value | 0x80);
|
||||
output.Add((byte)(value | 0x80));
|
||||
value >>= 7;
|
||||
}
|
||||
|
||||
@@ -55,4 +56,4 @@ namespace SabreTools.Data.Extensions
|
||||
return [.. output];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ namespace SabreTools.Data.Models.XZ
|
||||
|
||||
public static readonly byte[] FooterSignatureBytes = [0x59, 0x5A];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace SabreTools.Data.Models.XZ
|
||||
/// Unpadded size of the block
|
||||
/// </summary>
|
||||
/// <remarks>Stored as a variable-length integer</remarks>
|
||||
public byte UnpaddedSize { get; set; }
|
||||
public byte[]? UnpaddedSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Uncompressed size of the block
|
||||
|
||||
Reference in New Issue
Block a user