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>
Wed, 9 Jan 2013 18:25:23 +0000 (13:25 -0500)
commitecf2edf639926ad2a7842ebe1e6c456cc106e4c0
treee198889ea1cb814a48ab12e998aa6d775e62ce82
parent073b42da0335223bc1b83105e4b169181f792097
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.025887 seconds and 4 git commands to generate.