File tree Expand file tree Collapse file tree 1 file changed +3
-20
lines changed
Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -400,11 +400,7 @@ void A_LDM(ARM* cpu)
400400
401401 if (!(cpu->CurInstr & (1 <<23 )))
402402 {
403- for (int i = 0 ; i < 16 ; i++)
404- {
405- if (cpu->CurInstr & (1 <<i))
406- base -= 4 ;
407- }
403+ base -= 4 * __builtin_popcount (cpu->CurInstr & 0xFFFF );
408404
409405 if (cpu->CurInstr & (1 <<21 ))
410406 {
@@ -480,11 +476,7 @@ void A_STM(ARM* cpu)
480476
481477 if (!(cpu->CurInstr & (1 <<23 )))
482478 {
483- for (u32 i = 0 ; i < 16 ; i++)
484- {
485- if (cpu->CurInstr & (1 <<i))
486- base -= 4 ;
487- }
479+ base -= 4 * __builtin_popcount (cpu->CurInstr & 0xFFFF );
488480
489481 if (cpu->CurInstr & (1 <<21 ))
490482 cpu->R [baseid] = base;
@@ -701,18 +693,9 @@ void T_LDR_SPREL(ARM* cpu)
701693
702694void T_PUSH (ARM* cpu)
703695{
704- int nregs = 0 ;
696+ int nregs = __builtin_popcount (cpu-> CurInstr & 0x1FF ) ;
705697 bool first = true ;
706698
707- for (int i = 0 ; i < 8 ; i++)
708- {
709- if (cpu->CurInstr & (1 <<i))
710- nregs++;
711- }
712-
713- if (cpu->CurInstr & (1 <<8 ))
714- nregs++;
715-
716699 u32 base = cpu->R [13 ];
717700 base -= (nregs<<2 );
718701 cpu->R [13 ] = base;
You can’t perform that action at this time.
0 commit comments