From: NoEmail@nospicedham.trraxvfeqa.prg   
      
   On Tue, 24 Apr 2018 20:51:33 -0500   
   Robert Wessel wrote:   
      
   > On Tue, 24 Apr 2018 17:27:12 -0700 (PDT), Hac4u   
   > wrote:   
      
      
   > > What is the purpose of using SHR and SHL Instructions.   
   > >   
   > > 0x08048557 <+23>: shr eax,0x4   
   > > 0x0804855a <+26>: shl eax,0x4   
   > >=> 0x0804855d <+29>: sub esp,eax   
   > >   
   > > Why was shr and shl used?   
   > >   
   >   
   > The two shifts are to mask off the bottom four bits, IOW, to truncate   
   > it to a multiple of 16 bytes (to maintain stack alignment). The right   
   > shift shifts the four bottom bits off the right, the left shift shifts   
   > four zero bits back in.   
   >   
      
   While that is the effect, the code seems bizarre, even if it is   
   expected to be optimized away. Was there some reason to use SHR and   
   SHL instead of AND with a mask? E.g., need to keep CF clear for   
   possible SBB instead of SUB? E.g., code works for 32-bit and 64-bit   
   unlike a fixed size mask?   
      
      
   Rod Pemberton   
   --   
   I believe in the right to life. That's why I oppose gun control.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|