From 0793e9effe02e1ccd623704412aa750063f7d46b Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 21 Jul 2020 20:08:11 +0200 Subject: [PATCH] Fix develop compilation error This bug slipped by because my pre-commit hook for testing was broken... --- src/link/patch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/link/patch.c b/src/link/patch.c index 6b951017..20b31c6e 100644 --- a/src/link/patch.c +++ b/src/link/patch.c @@ -439,12 +439,12 @@ static void applyFilePatches(struct Section *section, struct Section *dataSectio /* Target is relative to the byte *after* the operand */ uint16_t address = patch->pcSection->org + patch->pcOffset + 1; - int16_t offset = value - address; + int16_t jumpOffset = value - address; - if (offset < -128 || offset > 127) + if (jumpOffset < -128 || jumpOffset > 127) error("%s: jr target out of reach (expected -129 < %" PRId16 " < 128)", - patch->fileName, offset); - dataSection->data[offset] = offset & 0xFF; + patch->fileName, jumpOffset); + dataSection->data[offset] = jumpOffset & 0xFF; } else { /* Patch a certain number of bytes */ struct {