private void EmitRelativeBranchTarget(int label)
{
// The relative offset of the label
int relOffset = 0;
// The position in the code stream of the label
int position;
// Did we see the label?
if (TryGetLabel(label, out position))
{
// Yes, calculate the relative offset
relOffset = position - ((int)codeStream.Position + 4);
}
else
{
// Forward jump, we can't resolve yet - store a patch
AddPatch(label, (int)codeStream.Position);
}
// Emit the relative jump offset (zero if we don't know it yet!)
codeStream.Write(relOffset, Endianness.Little);
}