Nikita Pettik
authored
Before this patch struct tuple had two boolean bit fields: is_dirty and has_uploaded_refs. It is worth mentioning that sizeof(boolean) is implementation depended. However, in code it is assumed to be 1 byte (there's static assertion restricting the whole struct tuple size by 10 bytes). So strictly speaking it may lead to the compilation error on some non-conventional system. Secondly, bit fields anyway consume at least one size of type (i.e. there's no space benefits in using two uint8_t bit fields - they anyway occupy 1 byte in total). There are several known pitfalls concerning bit fields: - Bit field's memory layout is implementation dependent; - sizeof() can't be applied to such members; - Complier may raise unexpected side effects (https://lwn.net/Articles/478657/). Finally, in our code base as a rule we use explicit masks: txn flags, vy stmt flags, sql flags, fiber flags. So, let's replace bit fields in struct tuple with single member called `flags` and several enum values corresponding to masks (to be more precise - bit positions in tuple flags). NO_DOC=<Refactoring> NO_CHANGELOG=<Refactoring> NO_TEST=<Refactoring>
Name | Last commit | Last update |
---|---|---|
.. | ||
gh-7089-vclock-copy | ||
CMakeLists.txt | ||
tuple.cc |