wait_ns micro-optimisation

Use `+ 1` to set the "Thumb" indicator on the `delay_loop` routine
address, rather than `| 1`. That makes it something that can be done
by the linker, rather than needing to be done at run-time.

Saves one instruction and one cycle.
pull/10609/head
Kevin Bracey 2019-05-21 14:37:02 +03:00
parent 8d15a2342f
commit a65b1a76ac
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ static const uint16_t delay_loop_code[] = {
};
/* Take the address of the code, set LSB to indicate Thumb, and cast to void() function pointer */
#define delay_loop ((void(*)()) ((uintptr_t) delay_loop_code | 1))
#define delay_loop ((void(*)()) ((uintptr_t) delay_loop_code + 1))
/* Some targets may not provide zero-wait-state flash performance. Export this function
* to be overridable for targets to provide more accurate implementation like locating