title: MSVC Inline ASM to GCC
body: <p>I'm trying to handle both MSVC and GCC compilers while updating this code base to work on GCC. But I'm unsure exactly how GCCs inline ASM works. Now I'm not great at translating ASM to C else I would just use C instead of ASM.</p>
  
  <pre><code>SLONG Div16(signed long a, signed long b)
  {
      signed long v;
  #ifdef __GNUC__ // GCC doesnt work.
  __asm() {
  #else // MSVC
  __asm {
  #endif
          mov edx, a
          mov ebx, b          
          mov eax, edx           
          shl eax, 16          
          sar edx, 16            
          idiv ebx              
          mov v, eax              
      }
      return v;
  }
  
  signed long ROR13(signed long val)
  {
      _asm{ 
          ror val, 13
      }
  }
  </code></pre>
  
  <p>I assume ROR13 works something like <code>(val &lt;&lt; 13) | (val &gt;&gt; (32 - 13))</code> but the code doesn't produce the same output.</p>
  
  <p>What is the proper way to translate this inline ASM to GCC and/or whats the C translation of this code?</p>