diff --git a/AssetRipper.TextureDecoder.ColorGenerator/NumericConversionGenerator.cs b/AssetRipper.TextureDecoder.ColorGenerator/NumericConversionGenerator.cs index 6924b9f..bbc9450 100644 --- a/AssetRipper.TextureDecoder.ColorGenerator/NumericConversionGenerator.cs +++ b/AssetRipper.TextureDecoder.ColorGenerator/NumericConversionGenerator.cs @@ -121,8 +121,7 @@ internal static class NumericConversionGenerator } else if (from.IsSignedInteger(out CSharpPrimitives.Data? unsignedFrom)) { - writer.WriteLine($"{unsignedFrom.LangName} unsigned = {ChangeSign}(value);"); - writer.WriteLine($"return {ConvertMethodName(unsignedFrom.Type)}(unsigned);"); + writer.WriteLine($"return {ConvertMethodName(unsignedFrom.Type)}({ChangeSign}(value));"); } else { diff --git a/AssetRipper.TextureDecoder/Rgb/NumericConversion.g.cs b/AssetRipper.TextureDecoder/Rgb/NumericConversion.g.cs index c638dbe..7108891 100644 --- a/AssetRipper.TextureDecoder/Rgb/NumericConversion.g.cs +++ b/AssetRipper.TextureDecoder/Rgb/NumericConversion.g.cs @@ -88,8 +88,7 @@ static partial class NumericConversion [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private static TTo ConvertSByte(sbyte value) where TTo : unmanaged { - byte unsigned = ChangeSign(value); - return ConvertByte(unsigned); + return ConvertByte(ChangeSign(value)); } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] @@ -230,8 +229,7 @@ static partial class NumericConversion [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private static TTo ConvertInt16(short value) where TTo : unmanaged { - ushort unsigned = ChangeSign(value); - return ConvertUInt16(unsigned); + return ConvertUInt16(ChangeSign(value)); } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] @@ -371,8 +369,7 @@ static partial class NumericConversion [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private static TTo ConvertInt32(int value) where TTo : unmanaged { - uint unsigned = ChangeSign(value); - return ConvertUInt32(unsigned); + return ConvertUInt32(ChangeSign(value)); } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] @@ -541,8 +538,7 @@ static partial class NumericConversion [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private static TTo ConvertInt64(long value) where TTo : unmanaged { - ulong unsigned = ChangeSign(value); - return ConvertUInt64(unsigned); + return ConvertUInt64(ChangeSign(value)); } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] @@ -686,8 +682,7 @@ static partial class NumericConversion [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private static TTo ConvertInt128(Int128 value) where TTo : unmanaged { - UInt128 unsigned = ChangeSign(value); - return ConvertUInt128(unsigned); + return ConvertUInt128(ChangeSign(value)); } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]