Fix: add mmap_base_offset to ctf_stream_pos
[babeltrace.git] / tests / test-bitfield.c
index 045b7d9484760a0ccaff29d46714f70f35872761..3bf7568280f87908bfee63240008c36900fd12dc 100644 (file)
@@ -7,8 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation; under version 2 of the License.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -119,7 +118,7 @@ do {                                        \
 
 int run_test_unsigned(void)
 {
-       unsigned long src, nrbits;
+       unsigned int src, nrbits;
        union {
                unsigned char c[TEST_LEN];
                unsigned short s[TEST_LEN/sizeof(unsigned short)];
@@ -127,7 +126,7 @@ int run_test_unsigned(void)
                unsigned long l[TEST_LEN/sizeof(unsigned long)];
                unsigned long long ll[TEST_LEN/sizeof(unsigned long long)];
        } target;
-       uint64_t readval;
+       unsigned long long readval;
        unsigned int s, l;
        int err = 0;
 
@@ -142,7 +141,7 @@ int run_test_unsigned(void)
                        bt_bitfield_write(target.c, unsigned char, s, l, src);
                        bt_bitfield_read(target.c, unsigned char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (bytewise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (bytewise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -152,7 +151,7 @@ int run_test_unsigned(void)
                        bt_bitfield_write(target.s, unsigned short, s, l, src);
                        bt_bitfield_read(target.c, unsigned char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (shortwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (shortwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -162,7 +161,7 @@ int run_test_unsigned(void)
                        bt_bitfield_write(target.i, unsigned int, s, l, src);
                        bt_bitfield_read(target.c, unsigned char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (intwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (intwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -172,7 +171,7 @@ int run_test_unsigned(void)
                        bt_bitfield_write(target.l, unsigned long, s, l, src);
                        bt_bitfield_read(target.c, unsigned char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (longwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (longwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -182,7 +181,7 @@ int run_test_unsigned(void)
                        bt_bitfield_write(target.ll, unsigned long long, s, l, src);
                        bt_bitfield_read(target.c, unsigned char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (longlongwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (longlongwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -198,7 +197,7 @@ int run_test_unsigned(void)
 
 int run_test_signed(void)
 {
-       long src, nrbits;
+       int src, nrbits;
        union {
                signed char c[TEST_LEN];
                short s[TEST_LEN/sizeof(short)];
@@ -206,7 +205,7 @@ int run_test_signed(void)
                long l[TEST_LEN/sizeof(long)];
                long long ll[TEST_LEN/sizeof(long long)];
        } target;
-       int64_t readval;
+       long long readval;
        unsigned int s, l;
        int err = 0;
 
@@ -224,7 +223,7 @@ int run_test_signed(void)
                        bt_bitfield_write(target.c, signed char, s, l, src);
                        bt_bitfield_read(target.c, signed char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (bytewise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (bytewise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -234,7 +233,7 @@ int run_test_signed(void)
                        bt_bitfield_write(target.s, short, s, l, src);
                        bt_bitfield_read(target.c, signed char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (shortwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (shortwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -244,7 +243,7 @@ int run_test_signed(void)
                        bt_bitfield_write(target.i, int, s, l, src);
                        bt_bitfield_read(target.c, signed char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (intwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (intwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -254,7 +253,7 @@ int run_test_signed(void)
                        bt_bitfield_write(target.l, long, s, l, src);
                        bt_bitfield_read(target.c, signed char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (longwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (longwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -264,7 +263,7 @@ int run_test_signed(void)
                        bt_bitfield_write(target.ll, long long, s, l, src);
                        bt_bitfield_read(target.c, signed char, s, l, &readval);
                        if (readval != src) {
-                               printf("Error (longlongwise) src %lX read %llX shift %d len %d\n",
+                               printf("Error (longlongwise) src %X read %llX shift %d len %d\n",
                                       src, readval, s, l);
                                print_byte_array(target.c, TEST_LEN);
                                err = 1;
@@ -318,7 +317,7 @@ int main(int argc, char **argv)
                unsigned long l[2];
                unsigned long long ll[1];
        } target;
-       uint64_t readval;
+       unsigned long long readval;
 
        if (argc > 1)
                src = atoi(argv[1]);
This page took 0.03531 seconds and 4 git commands to generate.