mirror of
https://github.com/AssetRipper/AssetRipper.TextureDecoder.git
synced 2026-11-13 02:21:29 -10:00
Fix bug in NumericConversion
This commit is contained in:
1 parent
ddcb97be28
commit
18a5b27333
2 files changed
+6
-4
No files matched your search
@@ -13,6 +13,7 @@ internal static class NumericConversionGenerator
|
||||
|
||||
public static void Run()
|
||||
{
|
||||
Console.WriteLine(ClassName);
|
||||
using IndentedTextWriter writer = IndentedTextWriterFactory.Create(OutputDirectory, ClassName);
|
||||
Write(writer);
|
||||
}
|
||||
@@ -214,7 +215,8 @@ internal static class NumericConversionGenerator
|
||||
writer.WriteLine("unchecked");
|
||||
using (new CurlyBrackets(writer))
|
||||
{
|
||||
writer.WriteLine($"{toName} converted = ({toName})(({conversionType})value >> {(fromSize / toSize - 1) * 8});");
|
||||
int offset = (fromSize / toSize - 1) * toSize * 8;
|
||||
writer.WriteLine($"{toName} converted = ({toName})(({conversionType})value >> {offset});");
|
||||
writer.WriteLine($"return Unsafe.As<{toName}, TTo>(ref converted);");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user