From 1395baefa9f68cdbc98ddda7e6f713968d0edf13 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Aug 2016 20:01:42 -0400 Subject: [PATCH] interface: Return register files by const reference Prevents unnecessary copies where they aren't particularly required. --- src/backend_x64/interface_x64.cpp | 4 ++-- src/interface/interface.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend_x64/interface_x64.cpp b/src/backend_x64/interface_x64.cpp index cab0a342..eb99f78f 100644 --- a/src/backend_x64/interface_x64.cpp +++ b/src/backend_x64/interface_x64.cpp @@ -144,7 +144,7 @@ void Jit::HaltExecution() { std::array& Jit::Regs() { return impl->jit_state.Reg; } -std::array Jit::Regs() const { +const std::array& Jit::Regs() const { return impl->jit_state.Reg; } @@ -152,7 +152,7 @@ std::array& Jit::ExtRegs() { return impl->jit_state.ExtReg; } -std::array Jit::ExtRegs() const { +const std::array& Jit::ExtRegs() const { return impl->jit_state.ExtReg; } diff --git a/src/interface/interface.h b/src/interface/interface.h index b790b110..a3abdd21 100644 --- a/src/interface/interface.h +++ b/src/interface/interface.h @@ -72,9 +72,9 @@ public: /// View and modify registers. std::array& Regs(); - std::array Regs() const; + const std::array& Regs() const; std::array& ExtRegs(); - std::array ExtRegs() const; + const std::array& ExtRegs() const; /// View and modify CPSR. u32& Cpsr();