how is memcpy more endian friendly in this case  you are never accessing any of the bytes directly  you are just dereferencing a byte opaque ptr and passing it as on opaque byte blob to ntohl in the function call below  you never perform bit byte operations on it until then  so  memcpy is superfluous here the only benefit to using memcpy here is that it is safer on platforms with hard alignment restrictions  as x could be unaligned here  so for that purpose  we should leave the memcpy  not for endianness 