Browse Source

DynASM/x64: Fix for full VREG support.

Thanks to Peter Cawley.
Mike Pall 9 years ago
parent
commit
22e7b00ddb
1 changed files with 2 additions and 1 deletions
  1. 2 1
      dynasm/dasm_x86.h

+ 2 - 1
dynasm/dasm_x86.h

@@ -403,6 +403,7 @@ int dasm_encode(Dst_DECL, void *buffer)
 	  unsigned char *ex = cp - (t&7);
 	  unsigned char *ex = cp - (t&7);
 	  if ((n & 8) && t < 0xa0) {
 	  if ((n & 8) && t < 0xa0) {
 	    if (*ex & 0x80) ex[1] ^= 0x20 << (t>>6); else *ex ^= 1 << (t>>6);
 	    if (*ex & 0x80) ex[1] ^= 0x20 << (t>>6); else *ex ^= 1 << (t>>6);
+	    n &= 7;
 	  } else if (n & 0x10) {
 	  } else if (n & 0x10) {
 	    if (*ex & 0x80) {
 	    if (*ex & 0x80) {
 	      *ex = 0xc5; ex[1] = (ex[1] & 0x80) | ex[2]; ex += 2;
 	      *ex = 0xc5; ex[1] = (ex[1] & 0x80) | ex[2]; ex += 2;
@@ -410,8 +411,8 @@ int dasm_encode(Dst_DECL, void *buffer)
 	    while (++ex < cp) ex[-1] = *ex;
 	    while (++ex < cp) ex[-1] = *ex;
 	    if (mark) mark--;
 	    if (mark) mark--;
 	    cp--;
 	    cp--;
+	    n &= 7;
 	  }
 	  }
-	  n &= 7;
 	  if (t >= 0xc0) n <<= 4;
 	  if (t >= 0xc0) n <<= 4;
 	  else if (t >= 0x40) n <<= 3;
 	  else if (t >= 0x40) n <<= 3;
 	  else if (n == 4 && t < 0x20) { cp[-1] ^= n; *cp++ = 0x20; }
 	  else if (n == 4 && t < 0x20) { cp[-1] ^= n; *cp++ = 0x20; }