Fix uatomic sign cast
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Mar 2012 15:27:01 +0000 (11:27 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Mar 2012 15:27:01 +0000 (11:27 -0400)
commite56d99bf2046a163875df80bab5195f38606dfde
treef57d354575521c2a6b65b9f86a27d10c3d729dae
parent7d5dc80de0522da1b8bc3656646ea39c15481594
Fix uatomic sign cast

Passing an unsigned int to uatomic_sub does not honor sign extend to
long, as we should be allowed by assume.

Fix this by introducing caa_cast_long_keep_sign(), which casts either to
long or unsigned long depending on the signedness of the argument
received. It is used in uatomic_sub before applying the "-" operator,
since this operator needs to operate on the "long" type size (since sign
extension might not be performed if the argument received is unsigned).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/test_uatomic.c
urcu/compiler.h
urcu/uatomic/generic.h
urcu/uatomic/ppc.h
urcu/uatomic/s390.h
urcu/uatomic/sparc64.h
urcu/uatomic/x86.h
This page took 0.034843 seconds and 4 git commands to generate.