You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the addition of NovelRT::Utilities::Misc::BitCast type punning can be expressed in a more easy to understand way. It has been used in a few places so far, but might be able to be used in more places to better express what is going on.
Something to watch out for is that when bitcasting an instance through pointers, such as this, you should take care and see if you should de-reference a variable before passing it as an argument. As some types have the same size as pointers, you might end up transforming the pointer instead of it's value.
The text was updated successfully, but these errors were encountered:
Pheubel
changed the title
Replace reinterpret_cast with NovelRT::Utilities::Misc::BitCast where appropriate
Replace reinterpret_cast with NovelRT::Utilities::Misc::BitCast where appropriate
Jan 26, 2023
With the addition of
NovelRT::Utilities::Misc::BitCast
type punning can be expressed in a more easy to understand way. It has been used in a few places so far, but might be able to be used in more places to better express what is going on.Something to watch out for is that when bitcasting an instance through pointers, such as
this
, you should take care and see if you should de-reference a variable before passing it as an argument. As some types have the same size as pointers, you might end up transforming the pointer instead of it's value.Example
Taking the following example:
Would become:
The text was updated successfully, but these errors were encountered: