]> git.gag.com Git - fw/sdcc/commitdiff
* src/pic16/gen.c (genPackBits): fix assignemnt to 8-bit,
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 4 Sep 2006 23:09:44 +0000 (23:09 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 4 Sep 2006 23:09:44 +0000 (23:09 +0000)
  byte-aligned bitfields, fixes #1539278

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4359 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/pic16/gen.c

index 36f6e5ec93442afe3c76bdeb4251d01fa39988cf..54e7aa36a2959adfd3cb577b2ac2c7de89779211 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-05 Raphael Neider <rneider AT web.de>
+
+       * src/pic16/gen.c (genPackBits): fix assignemnt to 8-bit,
+         byte-aligned bitfields, fixes #1539278
+
 2006-09-05 Raphael Neider <rneider AT web.de>
 
        * src/pic/gen.c (genReceive): skip unreferenced arguments,
index e87734409b0f077cbfdcfa2463198e2a36c3f81e..3c2cb78292d50ec13495537ec972fc534cbf9dc4 100644 (file)
@@ -11722,7 +11722,7 @@ static void genPackBits (sym_link    *etype , operand *result,
       || SPEC_BLEN(etype) <= 8 )  {
     int fsr0_setup = 0;
 
-    if (blen != 8 || bstr != 0) {
+    if (blen != 8 || (bstr % 8) != 0) {
       // we need to combine the value with the old value
       if(!shifted_and_masked)
       {
@@ -11757,7 +11757,12 @@ static void genPackBits (sym_link    *etype , operand *result,
         if (lit != 0)
          pic16_emitpcode(POC_IORLW, pic16_popGetLit(lit));
       }
-    } // if (blen != 8 || bstr != 0)
+    } else { // if (blen == 8 && (bstr % 8) == 0)
+       if (shifted_and_masked) {
+           // move right (literal) to WREG (only case where right is not yet in WREG)
+           pic16_mov2w(AOP(right), (bstr / 8));
+       }
+    }
 
     /* write new value back */
     if ((IS_SYMOP(result) && !IS_PTR(operandType(result)))