diff --git a/src/rp2_common/hardware_irq/irq.c b/src/rp2_common/hardware_irq/irq.c index 2705e03..211f6d0 100644 --- a/src/rp2_common/hardware_irq/irq.c +++ b/src/rp2_common/hardware_irq/irq.c @@ -159,19 +159,18 @@ static inline void *resolve_branch(uint16_t *inst) { // GCC produces horrible code for subtraction of pointers here, and it was bugging me static inline int8_t slot_diff(struct irq_handler_chain_slot *to, struct irq_handler_chain_slot *from) { static_assert(sizeof(struct irq_handler_chain_slot) == 12, ""); - int32_t result; + int32_t result = 0xaaaa; // return (to - from); // note this implementation has limited range, but is fine for plenty more than -128->127 result asm (".syntax unified\n" "subs %1, %2\n" "adcs %1, %1\n" // * 2 (and + 1 if negative for rounding) - "ldr %0, =0xaaaa\n" "muls %0, %1\n" "lsrs %0, 20\n" - : "=l" (result), "+l" (to) - : "l" (from) - : - ); + : "+l" (result), "+l" (to) + : "l" (from) + : + ); return (int8_t)result; }