bitfield-internal.h: fix negative value shifting warnings
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 31 May 2017 00:13:37 +0000 (20:13 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 9 Jun 2017 20:58:13 +0000 (16:58 -0400)
commita2d16120177a03f101a350a9b2531e4d2ac39233
treeb3bd208e5c724ac0204ada73cc2b0be1a73f1ed8
parent5c565c458535db2728ba850272f0d9ad4e92d748
bitfield-internal.h: fix negative value shifting warnings

This patch makes _bt_unsigned_cast() shift the complement of 0 casted to
uint64_t instead of the complement of 0 casted to a possibly signed
type, which results in shifting a negative value, an undefined operation
in C.

Because we're imposing uint64_t now, the size of the type and value's
type cannot be greater than the size of uint64_t... not a considerable
worry with the current state of commercial computing. Having said that,
the new _bt_check_max_64bit() macro, a static assertion, checks that
those type sizes are not greater than the size of uint64_t at build
time.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/bitfield-internal.h
This page took 0.024717 seconds and 4 git commands to generate.