)]}'
{"include/babeltrace/bitfield-internal.h":[{"author":{"_account_id":1000006,"name":"Jérémie Galarneau","email":"jeremie.galarneau@efficios.com","username":"jgalar","avatars":[{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d120","height":120}]},"change_message_id":"4f9660b1bfc1da3d16c813d896bd2f05350d0f0d","unresolved":true,"context_lines":[{"line_number":27,"context_line":"#include \u003cbabeltrace/compat/limits-internal.h\u003e\t/* C99 5.2.4.2 Numerical limits */"},{"line_number":28,"context_line":"#include \u003cbabeltrace/endian-internal.h\u003e\t/* Non-standard BIG_ENDIAN, LITTLE_ENDIAN, BYTE_ORDER */"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"/* We can\u0027t shift a int from 32 bit, \u003e\u003e 32 and \u003c\u003c 32 on int is undefined */"},{"line_number":31,"context_line":"#define _bt_piecewise_rshift(_v, _shift)\t\t\t\t\\"},{"line_number":32,"context_line":"({\t\t\t\t\t\t\t\t\t\\"},{"line_number":33,"context_line":"\ttypeof(_v) ___v \u003d (_v);\t\t\t\t\t\t\\"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"964a8b9f_b47c9719","side":"PARENT","line":30,"updated":"2019-05-16 19:14:58.000000000","message":"The rationale behind _bt_piecewise_r/lshift() explained by this comment appears to be lost in the patch. The intent of the piecewise shift was not obvious to me (vs directly using _bt_r/lshift()).\n\nNo strong opinion on this second point, but since both _bt_rshift and _bt_piecewise_rshift perform the same operation, only differing by their \"safety\", how about naming these variants as \"safe\"?\n\nAdding a proposal for comments.\n\ne.e.\n /*\n  * Right shift a signed or unsigned integer with `_shift` value being an\n  * arbitrary number of bits. `_v` is modified by this macro. The shift is\n  * performed \"bytewise\" to prevent the invocation of undefined behavior\n  * if shifting past the bitwidth of `_v` is possible.\n  */\n #define _bt_safe_rshift(_v, _shift)\n [...]\n\n /*\n  * Right shift a value `v` of `shift` bits.\n  *\n  * The type of `v` can be signed or unsigned integer.\n  * The value of `shift` must be less than the size of `v` (in bits),\n  * otherwise the behavior is undefined.\n  * Evaluates to the result of the shift operation.\n  *\n  * According to the C99 standard, right shift of a left hand-side signed\n  * type which has a negative value is implementation defined. This\n  * bitfield header relies on the right shift implementation carrying the\n  * sign bit. If the compiler implementation has a different behavior,\n  * emulate carrying the sign bit.\n  *\n  * This macro should not be used if `shift` can exceed the bitwidth of\n  * `v`. See `_bt_safe_rshift`.\n  */\n #define _bt_rshift(v, shift)\t((v) \u003e\u003e (shift))\n [...]","commit_id":"9223d1f36459ed833b1c4ce11001846d6b1d4e9d"},{"author":{"_account_id":1000009,"name":"Mathieu Desnoyers","email":"mathieu.desnoyers@efficios.com","username":"compudj","avatars":[{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d120","height":120}]},"change_message_id":"4d54610e6a61f75a73b0fd6929f3cff4788bfb7a","unresolved":true,"context_lines":[{"line_number":27,"context_line":"#include \u003cbabeltrace/compat/limits-internal.h\u003e\t/* C99 5.2.4.2 Numerical limits */"},{"line_number":28,"context_line":"#include \u003cbabeltrace/endian-internal.h\u003e\t/* Non-standard BIG_ENDIAN, LITTLE_ENDIAN, BYTE_ORDER */"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"/* We can\u0027t shift a int from 32 bit, \u003e\u003e 32 and \u003c\u003c 32 on int is undefined */"},{"line_number":31,"context_line":"#define _bt_piecewise_rshift(_v, _shift)\t\t\t\t\\"},{"line_number":32,"context_line":"({\t\t\t\t\t\t\t\t\t\\"},{"line_number":33,"context_line":"\ttypeof(_v) ___v \u003d (_v);\t\t\t\t\t\t\\"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"a879a001_a8cc8979","side":"PARENT","line":30,"in_reply_to":"964a8b9f_b47c9719","updated":"2019-05-16 19:47:54.000000000","message":"ok for _bt_safe_*. Changing the text you proposed to match the code though.","commit_id":"9223d1f36459ed833b1c4ce11001846d6b1d4e9d"},{"author":{"_account_id":1000006,"name":"Jérémie Galarneau","email":"jeremie.galarneau@efficios.com","username":"jgalar","avatars":[{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/8689763327e5bbda7dec9f18846b60ae.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d120","height":120}]},"change_message_id":"4f9660b1bfc1da3d16c813d896bd2f05350d0f0d","unresolved":true,"context_lines":[{"line_number":145,"context_line":" */"},{"line_number":146,"context_line":"#define _bt_piecewise_rshift(_v, _shift)\t\t\t\t\\"},{"line_number":147,"context_line":"do {\t\t\t\t\t\t\t\t\t\\"},{"line_number":148,"context_line":"\tunsigned long _sb \u003d (_shift) / (sizeof(_v) * CHAR_BIT - 1);\t\\"},{"line_number":149,"context_line":"\tunsigned long _final \u003d (_shift) % (sizeof(_v) * CHAR_BIT - 1);\t\\"},{"line_number":150,"context_line":"\t\t\t\t\t\t\t\t\t\\"},{"line_number":151,"context_line":"\tfor (; _sb; _sb--)\t\t\t\t\t\t\\"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d4156f2b_32afeac6","line":148,"updated":"2019-05-16 19:14:58.000000000","message":"`sb` and `final` are renamed to _sb and _final.\n\nSince `_sb` and `_final` are scoped to the do-while loop defined in other macros, the intent of the underscore prefix is unclear to me.\n\nMore generally, is there a convention as to whether 0, 1, or 2 leading underscores are to be used when naming a variable in this file? The _bt_bitfield_{read,write}_{l,b}e macros make use of the three possibilities.","commit_id":"f161d61dc34593c0e94c81901e9c36ab3b69d8bd"},{"author":{"_account_id":1000009,"name":"Mathieu Desnoyers","email":"mathieu.desnoyers@efficios.com","username":"compudj","avatars":[{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d32","height":32},{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d56","height":56},{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d100","height":100},{"url":"https://www.gravatar.com/avatar/7326b3e1d32b971a5e69d9730228c428.jpg?d\u003dretro\u0026r\u003dr\u0026s\u003d120","height":120}]},"change_message_id":"4d54610e6a61f75a73b0fd6929f3cff4788bfb7a","unresolved":true,"context_lines":[{"line_number":145,"context_line":" */"},{"line_number":146,"context_line":"#define _bt_piecewise_rshift(_v, _shift)\t\t\t\t\\"},{"line_number":147,"context_line":"do {\t\t\t\t\t\t\t\t\t\\"},{"line_number":148,"context_line":"\tunsigned long _sb \u003d (_shift) / (sizeof(_v) * CHAR_BIT - 1);\t\\"},{"line_number":149,"context_line":"\tunsigned long _final \u003d (_shift) % (sizeof(_v) * CHAR_BIT - 1);\t\\"},{"line_number":150,"context_line":"\t\t\t\t\t\t\t\t\t\\"},{"line_number":151,"context_line":"\tfor (; _sb; _sb--)\t\t\t\t\t\t\\"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d22768aa_d6a0182c","line":148,"in_reply_to":"d4156f2b_32afeac6","updated":"2019-05-16 19:47:54.000000000","message":"the prefixed underscores is useful when \"locally-scoped\" variables are declared within macros so they don\u0027t hide external variables from within the macro.\n\nFor instance, let\u0027s say the \"_v\" argument passed to _bt_piecewise_rshift here happens to contain a reference to a \"_sb\" variable. This will be shadows by the local definition of \"_sb\".\n\nOne more solid way to achieve this is to prefix each variable with the name of the macro they sit in, but it can quickly make the code unreadable. :/","commit_id":"f161d61dc34593c0e94c81901e9c36ab3b69d8bd"}]}
