@@ -288,31 +288,26 @@ bool HighLevelILIntegerList::ListIterator::operator<(const ListIterator& a) cons
288288HighLevelILIntegerList::ListIterator& HighLevelILIntegerList::ListIterator::operator ++()
289289{
290290 count--;
291- if (count == 0 )
292- return *this ;
293-
294- operand++;
295- if (operand >= 4 )
296- {
297- operand = 0 ;
298- instr = function->GetRawExpr ((size_t )instr.operands [4 ]);
299- }
291+ cur++;
300292 return *this ;
301293}
302294
303295
304296uint64_t HighLevelILIntegerList::ListIterator::operator *()
305297{
306- return instr. operands [operand] ;
298+ return *cur ;
307299}
308300
309301
310302HighLevelILIntegerList::HighLevelILIntegerList (
311- HighLevelILFunction* func, const BNHighLevelILInstruction& instr , size_t count)
303+ HighLevelILFunction* func, size_t offset , size_t count)
312304{
313305 m_start.function = func;
314- m_start.instr = instr;
315- m_start.operand = 0 ;
306+ #ifdef BINARYNINJACORE_LIBRARY
307+ m_start.cur = func->GetOperandPointer (offset);
308+ #else
309+ m_start.cur = BNHighLevelILGetOperandPointer (func->GetObject (), offset);
310+ #endif
316311 m_start.count = count;
317312}
318313
@@ -327,7 +322,7 @@ HighLevelILIntegerList::const_iterator HighLevelILIntegerList::end() const
327322{
328323 const_iterator result;
329324 result.function = m_start.function ;
330- result.operand = 0 ;
325+ result.cur = m_start. cur + m_start. count ;
331326 result.count = 0 ;
332327 return result;
333328}
@@ -343,10 +338,7 @@ uint64_t HighLevelILIntegerList::operator[](size_t i) const
343338{
344339 if (i >= size ())
345340 throw HighLevelILInstructionAccessException ();
346- auto iter = begin ();
347- for (size_t j = 0 ; j < i; j++)
348- ++iter;
349- return *iter;
341+ return m_start.cur [i];
350342}
351343
352344
@@ -367,8 +359,8 @@ size_t HighLevelILIndexList::ListIterator::operator*()
367359
368360
369361HighLevelILIndexList::HighLevelILIndexList (
370- HighLevelILFunction* func, const BNHighLevelILInstruction& instr , size_t count) :
371- m_list(func, instr , count)
362+ HighLevelILFunction* func, size_t offset , size_t count) :
363+ m_list(func, offset , count)
372364{}
373365
374366
@@ -427,9 +419,9 @@ const HighLevelILInstruction HighLevelILInstructionList::ListIterator::operator*
427419}
428420
429421
430- HighLevelILInstructionList::HighLevelILInstructionList (HighLevelILFunction* func, const BNHighLevelILInstruction& instr ,
422+ HighLevelILInstructionList::HighLevelILInstructionList (HighLevelILFunction* func, size_t offset ,
431423 size_t count, bool asFullAst, size_t instructionIndex) :
432- m_list(func, instr , count),
424+ m_list(func, offset , count),
433425 m_ast(asFullAst), m_instructionIndex(instructionIndex)
434426{}
435427
@@ -492,8 +484,8 @@ const SSAVariable HighLevelILSSAVariableList::ListIterator::operator*()
492484
493485
494486HighLevelILSSAVariableList::HighLevelILSSAVariableList (
495- HighLevelILFunction* func, const BNHighLevelILInstruction& instr , size_t count) :
496- m_list(func, instr , count & (~1 ))
487+ HighLevelILFunction* func, size_t offset , size_t count) :
488+ m_list(func, offset , count & (~1 ))
497489{}
498490
499491
@@ -800,19 +792,19 @@ SSAVariable HighLevelILInstructionBase::GetRawOperandAsSSAVariable(size_t operan
800792HighLevelILInstructionList HighLevelILInstructionBase::GetRawOperandAsExprList (size_t operand) const
801793{
802794 return HighLevelILInstructionList (
803- function, function-> GetRawExpr ( operands[operand + 1 ]), operands[operand], ast, instructionIndex);
795+ function, ( size_t ) operands[operand + 1 ], ( size_t ) operands[operand], ast, instructionIndex);
804796}
805797
806798
807799HighLevelILSSAVariableList HighLevelILInstructionBase::GetRawOperandAsSSAVariableList (size_t operand) const
808800{
809- return HighLevelILSSAVariableList (function, function-> GetRawExpr ( operands[operand + 1 ]), operands[operand]);
801+ return HighLevelILSSAVariableList (function, ( size_t ) operands[operand + 1 ], ( size_t ) operands[operand]);
810802}
811803
812804
813805HighLevelILIndexList HighLevelILInstructionBase::GetRawOperandAsIndexList (size_t operand) const
814806{
815- return HighLevelILIndexList (function, function-> GetRawExpr ( operands[operand + 1 ]), operands[operand]);
807+ return HighLevelILIndexList (function, ( size_t ) operands[operand + 1 ], ( size_t ) operands[operand]);
816808}
817809
818810
0 commit comments