pYro_65:
How about this:2,166 bytes now compared to previous 2,260 bytes
Yes, well the compiler optimized all your fancy stuff away. They like to do that. ![]()
000000be <loop>:
byte b = 0x0E;
byte c = 0x0C;
byte d = 0x0D;
byte e = 0x0A;
NewUnion aa = {{ ( d << 4 ) | e, ( b << 4 ) | c, a, 0 }};
be: 4a ed ldi r20, 0xDA ; 218
c0: 50 e0 ldi r21, 0x00 ; 0
c2: 60 e0 ldi r22, 0x00 ; 0
c4: 70 e0 ldi r23, 0x00 ; 0
c6: 5c ee ldi r21, 0xEC ; 236
c8: 6f e0 ldi r22, 0x0F ; 15
Serial.println (aa.l, HEX);
ca: 88 e9 ldi r24, 0x98 ; 152
cc: 91 e0 ldi r25, 0x01 ; 1
ce: 20 e1 ldi r18, 0x10 ; 16
d0: 30 e0 ldi r19, 0x00 ; 0
d2: 0e 94 53 03 call 0x6a6 ; 0x6a6 <_ZN5Print7printlnEmi>
}
d6: 08 95 ret
It converted it into 6 LDI (load immediate value) instructions. The struct only exists in the source.