summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9d9b332)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4fbf927d4b2ff1c8b68b05c7843298c64b68f5a4
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1342
Tested-by: jenkins
unsigned long long readval;
unsigned int s, l;
unsigned long long readval;
unsigned int s, l;
+ /* The number of bits needed to represent 0 is 0. */
nrbits_ui = fls_u32(src_ui);
/* Write from unsigned integer src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
nrbits_ui = fls_u32(src_ui);
/* Write from unsigned integer src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_ui; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_ui; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ui);
bt_bitfield_read(target.c, unsigned char, s, l, &readval);
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ui);
bt_bitfield_read(target.c, unsigned char, s, l, &readval);
}
pass(UNSIGNED_INT_WRITE_TEST_DESC_FMT_STR, src_ui);
}
pass(UNSIGNED_INT_WRITE_TEST_DESC_FMT_STR, src_ui);
+ /* The number of bits needed to represent 0 is 0. */
nrbits_ull = fls_u64(src_ull);
/* Write from unsigned long long src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
nrbits_ull = fls_u64(src_ull);
/* Write from unsigned long long src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_ull; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_ull; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ull);
bt_bitfield_read(target.c, unsigned char, s, l, &readval);
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ull);
bt_bitfield_read(target.c, unsigned char, s, l, &readval);
unsigned long long readval_ull;
unsigned int s, l;
unsigned long long readval_ull;
unsigned int s, l;
+ /* The number of bits needed to represent 0 is 0. */
nrbits_ui = fls_u32(src_ui);
/* Read to unsigned integer readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
nrbits_ui = fls_u32(src_ui);
/* Read to unsigned integer readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_ui; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_ui; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ui);
bt_bitfield_read(target.c, unsigned char, s, l, &readval_ui);
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ui);
bt_bitfield_read(target.c, unsigned char, s, l, &readval_ui);
}
pass(UNSIGNED_INT_READ_TEST_DESC_FMT_STR, src_ui);
}
pass(UNSIGNED_INT_READ_TEST_DESC_FMT_STR, src_ui);
+ /* The number of bits needed to represent 0 is 0. */
nrbits_ull = fls_u64(src_ull);
/* Read to unsigned long long readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
nrbits_ull = fls_u64(src_ull);
/* Read to unsigned long long readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_ull; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_ull; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ull);
bt_bitfield_read(target.c, unsigned char, s, l, &readval_ull);
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, unsigned char, s, l, src_ull);
bt_bitfield_read(target.c, unsigned char, s, l, &readval_ull);
/* Write from signed integer src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
/* Write from signed integer src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_i; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_i; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0x0);
bt_bitfield_write(target.c, signed char, s, l, src_i);
bt_bitfield_read(target.c, signed char, s, l, &readval);
init_byte_array(target.c, TEST_LEN, 0x0);
bt_bitfield_write(target.c, signed char, s, l, src_i);
bt_bitfield_read(target.c, signed char, s, l, &readval);
/* Write from signed long long src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
/* Write from signed long long src input. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_ll; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_ll; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0x0);
bt_bitfield_write(target.c, signed char, s, l, src_ll);
bt_bitfield_read(target.c, signed char, s, l, &readval);
init_byte_array(target.c, TEST_LEN, 0x0);
bt_bitfield_write(target.c, signed char, s, l, src_ll);
bt_bitfield_read(target.c, signed char, s, l, &readval);
/* Read to signed integer readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
/* Read to signed integer readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_i; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_i; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, signed char, s, l, src_i);
bt_bitfield_read(target.c, signed char, s, l, &readval_i);
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, signed char, s, l, src_i);
bt_bitfield_read(target.c, signed char, s, l, &readval_i);
/* Read to signed long long readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
/* Read to signed long long readval output. */
for (s = 0; s < CHAR_BIT * TEST_LEN; s++) {
- for (l = nrbits_ll; l < (CHAR_BIT * TEST_LEN) - s; l++) {
+ for (l = nrbits_ll; l <= (CHAR_BIT * TEST_LEN) - s; l++) {
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, signed char, s, l, src_ll);
bt_bitfield_read(target.c, signed char, s, l, &readval_ll);
init_byte_array(target.c, TEST_LEN, 0xFF);
bt_bitfield_write(target.c, signed char, s, l, src_ll);
bt_bitfield_read(target.c, signed char, s, l, &readval_ll);