lora_device_lib icon indicating copy to clipboard operation
lora_device_lib copied to clipboard

Simplify function timerDelta()

Open frbehrens opened this issue 5 years ago • 0 comments

I believe - because we use for all operands and the result the same integer type - we can simplify the function in ldl_mac.c

static uint32_t timerDelta(uint32_t timeout, uint32_t time)
{
    return (timeout <= time) ? (time - timeout) : (UINT32_MAX - timeout + time);
}

to

static uint32_t timerDelta(uint32_t timeout, uint32_t time)
{
    return (time - timeout);
}

frbehrens avatar Oct 30 '20 17:10 frbehrens