Search code examples
c#.netassemblycil

MSIL opcode: br vs br.s?


What are differences between MSIL opcodes: br and br.s?

0x38 br Branch to target.

vs

0x2B br.s Branch to target, short form.


Solution

  • From the documentation

    The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.

    The difference is the size of the target, most jumps happen close around a location so it makes sense to optimize this instruction for size, reducing the total size of the IL, which may have several benefits (faster load times, smaller .dll sizes, etc)