Now that I can reliably get a sketch disassembly I can compare the two sections of code which prompted this thread.
Here's the if/else code from the class version:
/*
----- condition the timer timing status
*/
if ((_Enable or _Control) and !_Done and !_Reset) {
40e: 2e 81 ldd r18, Y+6 ; 0x06
410: 21 fd sbrc r18, 1
412: 02 c0 rjmp .+4 ; 0x418 <__LOCK_REGION_LENGTH__+0x18>
414: 24 ff sbrs r18, 4
416: 06 c0 rjmp .+12 ; 0x424 <__LOCK_REGION_LENGTH__+0x24>
418: 81 11 cpse r24, r1
41a: 04 c0 rjmp .+8 ; 0x424 <__LOCK_REGION_LENGTH__+0x24>
41c: 20 fd sbrc r18, 0
41e: 02 c0 rjmp .+4 ; 0x424 <__LOCK_REGION_LENGTH__+0x24>
_TimerRunning = true;
420: 91 60 ori r25, 0x01 ; 1
422: 01 c0 rjmp .+2 ; 0x426 <__LOCK_REGION_LENGTH__+0x26>
}
else _TimerRunning = false;
424: 9e 7f andi r25, 0xFE ; 254
426: 9b 8b std Y+19, r25 ; 0x13
return _Done;
And the boolean code from the class version:
_TimerRunning = (_Enable or _Control) and !_Done and !_Reset;
410: 9e 81 ldd r25, Y+6 ; 0x06
412: 91 fd sbrc r25, 1
414: 05 c0 rjmp .+10 ; 0x420 <__LOCK_REGION_LENGTH__+0x20>
416: 94 fb bst r25, 4
418: 22 27 eor r18, r18
41a: 20 f9 bld r18, 0
41c: 94 ff sbrs r25, 4
41e: 07 c0 rjmp .+14 ; 0x42e <__LOCK_REGION_LENGTH__+0x2e>
420: 81 11 cpse r24, r1
422: 04 c0 rjmp .+8 ; 0x42c <__LOCK_REGION_LENGTH__+0x2c>
424: 90 95 com r25
426: 29 2f mov r18, r25
428: 21 70 andi r18, 0x01 ; 1
42a: 01 c0 rjmp .+2 ; 0x42e <__LOCK_REGION_LENGTH__+0x2e>
42c: 20 e0 ldi r18, 0x00 ; 0
42e: 9b 89 ldd r25, Y+19 ; 0x13
430: 20 fb bst r18, 0
432: 90 f9 bld r25, 0
434: 9b 8b std Y+19, r25 ; 0x13
return _Done;
It's speculation but I'm guessing the boolean version takes more memory because there's no variable (register) to work from, it's all sort of juggled 'til the final result is arrived at. This implies it also takes more clock cycles. It's counterintuitive to me because the C++ version of the boolean code appears simpler than the if/else code. Go figure.