-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Exploit Unused Bits in Dof
#12263
base: master
Are you sure you want to change the base?
Conversation
Looks great, but compilation is failing |
@@ -347,26 +343,67 @@ class Dof{ | |||
mIsFixed=false; | |||
} | |||
|
|||
/// @brief Mark this @p Dof active. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use
/**
*
*/
style
ready for review |
…into core/dof-bit-squeeze
Ping reviewers. I understand if this, or the other PR, is not exactly the solution you want to see but you need to tell me that if it's the case. #11916 prohibits me from progressing with my work, and I need to know at least the interface of its solution (we can iron out implementation details later, but I need to know how I can get extra information from |
This PR addresses #11916 and adds a restricted set of flags to
Dof
, but unlike #12196, it does not increase its size. The price to pay for it is fewer flags and more complex code.Kratos/kratos/includes/dof.h
Lines 439 to 452 in 7bf35ed
In total, 4 extra bits can be used in
Dof
without increasing its size:Dof
was1 + 4 + 4 + 6 + 48 + 64 = 127
, which means that one extra bitmIsActive
could be squeezed into the list of member variables.NodalData
has an alignment requirement of 8 bytes. This means that any valid pointer to aNodalData
instance must be a multiple of 8 (2³). As a result, the lowest 8 bits of anyNodalData*
is always 000 and we can exploit this fact to hide 3 bits of some other information (such as 3 flags) there.