ctf.fs: bt_ctf_notif_iter_create(): assert() that all medops exist
[babeltrace.git] / formats / ctf-text / types / integer.c
index f4d392563b1db522bf580f53ea4f27949339f6bf..c08aa4bc24412b3573fd27af9b147ae703adb9dd 100644 (file)
@@ -31,7 +31,7 @@
 #include <inttypes.h>
 #include <stdint.h>
 #include <babeltrace/bitfield.h>
-#include <babeltrace/trace-debuginfo.h>
+#include <babeltrace/trace-debug-info.h>
 
 int ctf_text_integer_write(struct bt_stream_pos *ppos, struct bt_definition *definition)
 {
@@ -106,11 +106,12 @@ int ctf_text_integer_write(struct bt_stream_pos *ppos, struct bt_definition *def
                } else {
                        v = (uint64_t) integer_definition->value._signed;
                        if (integer_declaration->len < 64) {
-                               /* Round length to the nearest 3-bit */
-                               uint8_t rounded_len =
-                                       integer_declaration->len +
-                                       ((integer_declaration->len + 2) % 3);
+                               size_t len = integer_declaration->len;
+                               size_t rounded_len;
 
+                               assert(len != 0);
+                               /* Round length to the nearest 3-bit */
+                               rounded_len = (((len - 1) / 3) + 1) * 3;
                                v &= ((uint64_t) 1 << rounded_len) - 1;
                        }
                }
This page took 0.023605 seconds and 4 git commands to generate.