-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimized drawPixel() and fixed Arduino IDE 1.8.6/1.8.7 issue #37
Conversation
The new compiler In Arduino IDE 1.8.6/1.8.7 has an optimization glitch where it fails to see the difference between a data structure in RAM and in PROGMEM when the data is the same and optimizes one out. drawPixel() is unable to fetch the correct pixel mask from the bitshift_left array in PROGMEM causing junk to be drawn The bitshift_left[] array has now been optimised out and drawPixel() will function properly. The optimisation uses the same number of cycles and saves 6 bytes drawPixel() has also been made static so the Arduboy object pointer is no longer needlesly passed on to drawPixel() saving more bytes DrawPixel has
|
and
Obviously not clear enough so I'll add some at the right side
Will remove both comments
Will remove |
submitted change PR #38 |
Sorry about being picky about this and not making my requests clearer. The new comments on the right of the assembly are helpful, and can be left there, but I'd also like the C++ code as a commented out standalone working function following the "live" source code. This way, for someone wanting to quickly port to a different architecture without using assembly, the existing "live" code can be removed or commented out, then the commented out C++ code can just be uncommented to replace it. The person doing the port doesn't have to figure how to remove the assembly code, and what comments to keep or uncomment and what to discard. In other words, write a working C++ only equivalent. Then, comment it out and have it follow the "live" assembly/mixed version of the function. You can look at paintScreen() for an example of this. The C++ version is commented out using a Also, (sorry, I should have looked more closely at your commit message), I try to follow the Tim Pope suggested 50/72 format for Git commit messages
E.g. you could use |
The original code didn't have such a block but I guess you could just append
But you could also use something as below then you don't need to comment and change those if directives.
I'll try to keep suggested git message format in mind. |
The new compiler In Arduino IDE 1.8.6/1.8.7 has an optimization glitch where it fails to see the difference between a data structure in RAM and in PROGMEM when the data is the same and optimizes one out.
drawPixel() is unable to fetch the correct pixel mask from the bitshift_left array in PROGMEM causing junk to be drawn
The bitshift_left[] array has now been optimised out and drawPixel() will function properly. The optimisation uses the same number of cycles and saves 6 bytes
drawPixel() has also been made static so the Arduboy object pointer is no longer needlesly passed on to drawPixel() saving more bytes
DrawPixel has