mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
8d15a2342f
commit
a65b1a76ac
|
@ -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 */
|
/* 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
|
/* 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
|
* to be overridable for targets to provide more accurate implementation like locating
|
||||||
|
|
Loading…
Reference in New Issue