Fix: counter: cast UINT*_MAX to 64-bit signed type before negative
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 26 Nov 2020 20:29:01 +0000 (15:29 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 26 Nov 2020 20:29:01 +0000 (15:29 -0500)
commita40716088ab08fa708b2b2ba5024c3c62eee8805
tree1672f2534f37244ac69d4f4b762d36ec2b917686
parent00adec46a40302f315a5d18b3f4b601beb6cd059
Fix: counter: cast UINT*_MAX to 64-bit signed type before negative

(long long)-UINT32_MAX leads to value 1 which is not what we expect.
This is due to implicit type promotion from unsigned to signed 32-bit
integer.

Apply this to 8-bit and 16-bit types as well even though they are
not affected by this issue to keep things regular.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8e05f270eae71cb15848075c4dfae80e8070fd80
libcounter/counter-api.h
This page took 0.024495 seconds and 4 git commands to generate.