From b2a4da5e65985e6b0a20ac8ac37d14425a2a39d9 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 11 Apr 2021 15:37:07 +0100 Subject: [PATCH] block_of_code: Correct SpaceRemaining --- src/backend/x64/block_of_code.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/x64/block_of_code.cpp b/src/backend/x64/block_of_code.cpp index 8b96b8af..59044e52 100644 --- a/src/backend/x64/block_of_code.cpp +++ b/src/backend/x64/block_of_code.cpp @@ -120,7 +120,7 @@ size_t BlockOfCode::SpaceRemaining() const { return 0; if (current_far_ptr >= &top_[maxSize_]) return 0; - return std::min(current_near_ptr - reinterpret_cast(far_code_begin), current_far_ptr - &top_[maxSize_]); + return std::min(reinterpret_cast(far_code_begin) - current_near_ptr, &top_[maxSize_] - current_far_ptr); } void BlockOfCode::RunCode(void* jit_state, CodePtr code_ptr) const {