Skip to content

Instantly share code, notes, and snippets.

@Mathiasb17
Created February 15, 2019 09:39
Show Gist options
  • Save Mathiasb17/b407cc8767ae68113e78df3a5b41aae5 to your computer and use it in GitHub Desktop.
Save Mathiasb17/b407cc8767ae68113e78df3a5b41aae5 to your computer and use it in GitHub Desktop.
This function swaps half bytes in one byte
/**
* @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