Fixed SRCMOD_NEGATE usage when assembling.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 24 Feb 2009 01:53:24 -0500
changeset 696 c9e03dc63eb8
parent 695 bb19124e7fdc
child 697 765a85a989a2
Fixed SRCMOD_NEGATE usage when assembling.
mojoshader_assembler.c
--- a/mojoshader_assembler.c	Tue Feb 24 01:53:04 2009 -0500
+++ b/mojoshader_assembler.c	Tue Feb 24 01:53:24 2009 -0500
@@ -719,8 +719,14 @@
     int regnum;
     parse_register_name(ctx, &regtype, &regnum);
 
-    if (ctx->tokenlen > 0)
+    if (ctx->tokenlen == 0)
     {
+        if (negate)
+            set_source_mod(ctx, negate, SRCMOD_NONE, SRCMOD_NEGATE, &srcmod);
+    } // if
+    else
+    {
+        assert(ctx->tokenlen > 0);
         if (check_token_segment(ctx, "_bias"))
             set_source_mod(ctx, negate, SRCMOD_BIAS, SRCMOD_BIASNEGATE, &srcmod);
         else if (check_token_segment(ctx, "_bx2"))
@@ -735,7 +741,7 @@
             set_source_mod(ctx, negate, SRCMOD_ABS, SRCMOD_ABSNEGATE, &srcmod);
         else
             fail(ctx, "Invalid source modifier");
-    } // if
+    } // else
 
     uint32 relative = 0;
     if (nexttoken(ctx) != ((Token) '['))