diff options
author | cpldcpu <cpldcpu@gmail.com> | 2013-10-07 01:05:23 +0200 |
---|---|---|
committer | cpldcpu <cpldcpu@gmail.com> | 2013-10-07 01:05:23 +0200 |
commit | bfc82adaf601462b5bb27afd20d5f655f5537146 (patch) | |
tree | 17e9712d4bfcdbeba167cd27ca61fc2f08175ccb /firmware/libs-device/osccal.c | |
parent | a3fdc6f10b89ef806e2f4744f3f5de667c0df84f (diff) | |
download | micronucleus-bfc82adaf601462b5bb27afd20d5f655f5537146.tar.gz micronucleus-bfc82adaf601462b5bb27afd20d5f655f5537146.tar.bz2 micronucleus-bfc82adaf601462b5bb27afd20d5f655f5537146.zip |
Do modulo only on lower byte - saves 24 bytes
GCC generated some quite weird code from the module operations. Although
highly optimized, most of the instructions are redundant. Is this a bug?
The current solution is a bit hacky, but should also work when the pages
size is changed in future devices.
uchar isLast = (((currentAddress&0xff) % SPM_PAGESIZE) == 0);
1e02: 80 91 69 00 lds r24, 0x0069
1e06: 90 91 6a 00 lds r25, 0x006A
1e0a: 8f 73 andi r24, 0x3F ; 63
1e0c: 99 27 eor r25, r25
// definitely need this if! seems usbFunctionWrite gets called again in
future usbPoll's in the runloop!
if (isLast) fireEvent(EVENT_WRITE_PAGE); // ask runloop to write our
page
1e0e: 89 2b or r24, r25
1e10: 39 f0 breq .+14 ; 0x1e20 <main+0x1ee>
1e12: 0d c0 rjmp .+26 ; 0x1e2e <main+0x1fc>
Diffstat (limited to 'firmware/libs-device/osccal.c')
0 files changed, 0 insertions, 0 deletions