I'm trying to write a C function that takes a uint64_t
and replace it's nth byte to a given one.
void setByte(uint64_t *bytes, uint8_t byte, pos)
I know I can easily get the nth byte like so
uint8_t getByte(uint64_t bytes, int pos)
{
return (bytes >> (8 * pos)) & 0xff;
}
But I have no idea how to Set the nth byte