> > How about
> >
> > void test3(void)
> > {
> > x.b = (y.c == true);
> > }
> >
> 
> I haven't tried that one, but I don't think it will make any difference
> compared to "x.b = y.c" or "x.b = y.c ? true : false;".
+void test1(void)
+{
+       x.b = y.c;
+    f162:      5e 42 06 02             mov.b   &0x0206,r14     ;src
addr 0x0
206
+    f166:      12 c3                   clrc                    
+    f168:      4e 10                   rrc.b   r14             ;
+    f16a:      4e 11                   rra.b   r14             ;
+    f16c:      4e 11                   rra.b   r14             ;
+    f16e:      6e f3                   and.b   #2,     r14     ;subst
r3 wit
h As==10
+    f170:      5f 42 05 02             mov.b   &0x0205,r15     ;src
addr 0x0
205
+    f174:      6f c3                   bic.b   #2,     r15     ;subst
r3 wit
h As==10
+    f176:      4f de                   bis.b   r14,    r15     ;
+    f178:      c2 4f 05 02             mov.b   r15,    &0x0205 ;
+}      
+    f17c:      30 41                   ret                     

+void test2(void)
+{
+       if (y.c) x.b = true; else x.b = false;
+    f162:      e2 b2 06 02             bit.b   #4,     &0x0206 ;subst
r2 wit
h As==10
+    f166:      03 24                   jz      $+8             ;abs dst
addr
 0xf16e
+    f168:      e2 d3 05 02             bis.b   #2,     &0x0205 ;subst
r3 wit
h As==10
+}      
+    f16c:      30 41                   ret                     
+    f16e:      e2 c3 05 02             bic.b   #2,     &0x0205 ;subst
r3 wit
h As==10
+    f172:      30 41                   ret                     


+void test3(void)
+{
+       x.b = (y.c == true);
+    f162:      5e 42 06 02             mov.b   &0x0206,r14     ;src
addr 0x0
206
+    f166:      12 c3                   clrc                    
+    f168:      4e 10                   rrc.b   r14             ;
+    f16a:      6e f3                   and.b   #2,     r14     ;subst
r3 wit
h As==10
+    f16c:      5f 42 05 02             mov.b   &0x0205,r15     ;src
addr 0x0
205
+    f170:      6f c3                   bic.b   #2,     r15     ;subst
r3 wit
h As==10
+    f172:      4f de                   bis.b   r14,    r15     ;
+    f174:      c2 4f 05 02             mov.b   r15,    &0x0205 ;
+}      
+    f178:      30 41                   ret                     

It saves 2 rra's

Garst

Reply via email to