Created
February 15, 2019 09:39
-
-
Save Mathiasb17/b407cc8767ae68113e78df3a5b41aae5 to your computer and use it in GitHub Desktop.
This function swaps half bytes in one byte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @brief swap nibbles in one byte | |
* | |
* @param[in,out] io_value | |
*/ | |
inline void NibblesSwap(std::uint8_t & io_value) | |
{ | |
io_value = ((io_value & 0x0FU) << 4U) | ((io_value & 0xF0U) >> 4U); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment