From 8f2c237b8315a7d662e0e67d06807296a7bbe5ab Mon Sep 17 00:00:00 2001 From: kobalicek Date: Tue, 18 Oct 2022 18:43:48 +0200 Subject: [PATCH] Added x86::Mem::cloneResized() to complement cloneAdjusted() and cloneBroadcasted() --- src/asmjit/x86/x86operand.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/asmjit/x86/x86operand.h b/src/asmjit/x86/x86operand.h index e4c3275..8781be1 100644 --- a/src/asmjit/x86/x86operand.h +++ b/src/asmjit/x86/x86operand.h @@ -790,15 +790,23 @@ public: //! Clones the memory operand. inline constexpr Mem clone() const noexcept { return Mem(*this); } - //! Creates a new copy of this memory operand adjusted by `off`. + //! Creates a copy of this memory operand adjusted by `off`. inline Mem cloneAdjusted(int64_t off) const noexcept { Mem result(*this); result.addOffset(off); return result; } - inline constexpr Mem cloneBroadcasted(Broadcast b) const noexcept { - return Mem((_signature & ~Signature{kSignatureMemBroadcastMask}) | Signature::fromValue(b), _baseId, _data[0], int32_t(_data[1])); + //! Creates a copy of this memory operand resized to `size`. + inline Mem cloneResized(uint32_t size) const noexcept { + Mem result(*this); + result.setSize(size); + return result; + } + + //! Creates a copy of this memory operand with a broadcast `bcst`. + inline constexpr Mem cloneBroadcasted(Broadcast bcst) const noexcept { + return Mem((_signature & ~Signature{kSignatureMemBroadcastMask}) | Signature::fromValue(bcst), _baseId, _data[0], int32_t(_data[1])); } //! \}