From 12ca82e40ad6a9b2d7bcabf5d50b28e83505f349 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 26 Dec 2015 19:55:08 -0800 Subject: [PATCH] fix branching in some cases --- lips.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lips.lua b/lips.lua index eda3bf4..adec155 100644 --- a/lips.lua +++ b/lips.lua @@ -1474,7 +1474,9 @@ function Dumper:desym(tok) if label == nil then self:error('undefined label') end - local rel = floor(label/4) - 1 - floor(self.pos/4) + label = label % 0x80000000 + local pos = self.pos % 0x80000000 + local rel = floor(label/4) - 1 - floor(pos/4) if rel > 0x8000 or rel <= -0x8000 then self:error('branch too far') end