diff --git a/src/ComputeSharp.Shaders/Extensions/ILGeneratorExtensions.cs b/src/ComputeSharp.Shaders/Extensions/ILGeneratorExtensions.cs index acd78cf8..9b676f16 100644 --- a/src/ComputeSharp.Shaders/Extensions/ILGeneratorExtensions.cs +++ b/src/ComputeSharp.Shaders/Extensions/ILGeneratorExtensions.cs @@ -99,7 +99,7 @@ namespace System.Reflection.Emit public static void EmitAddOffset(this ILGenerator il, int offset) { // Push the offset to the stack - if (offset < 128) il.Emit(OpCodes.Ldc_I4, offset); + if (offset < -128) il.Emit(OpCodes.Ldc_I4, offset); else if (offset < 0) il.Emit(OpCodes.Ldc_I4_S, (sbyte)offset); else if (offset <= 8) {