lib/timer: BusyWaitCounter missing explicit cast

bug from wsirko, issue #247

The while loops are missing an explicit cast (please look at the diff).
According to the C lang spec, if for example a variable has type
"size_type" = uint16_t, the type will be promoted to int when any operation
is performed on that variable.

For certain values this will cause those while loops to spin forever.

Force the right behaviour by casting the comparison to (size_type).

Fixes #247