Use native register width integer in the core loop
I noticed that there was a `uxth` (sign extending) instruction in the hot loop of the code, because the native registers are 32 bits but we were using a 16-bit type for the counter. In this case, gcc emits two instructions (inc + uxth) to increment `pulse_count` when just one would suffice. At 120MHz, this changes the peaks from ~21/22, 34/35, 48 to 25/26, 41/42, 57.
This commit is contained in:
parent
ca707cba20
commit
cd34af79df
1 changed files with 1 additions and 1 deletions
|
|
@ -282,7 +282,7 @@ int8_t Adafruit_Floppy::track(void) { return _track; }
|
|||
/**************************************************************************/
|
||||
__attribute__((optimize("O3")))
|
||||
uint32_t Adafruit_Floppy::capture_track(uint8_t *pulses, uint32_t max_pulses) {
|
||||
uint16_t pulse_count;
|
||||
unsigned pulse_count;
|
||||
uint8_t *pulses_ptr = pulses;
|
||||
uint8_t *pulses_end = pulses + max_pulses;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue