Moved include for endian.h outside the function definition to get rid of the error