endianness? big endian? little endian?

I’m going to be writing an NTP client of sorts and I’m wondering the endianness of arduino. I wrote a test sketch to check endianness but I wont be able to run it until tomorrow when I get home :-/

void setup () {
  Serial.begin(9600);
  uint8_t packet_buffer[64];
  uint8_t packet_buffer_len=48;
  uint32_t* variable = (uint32_t*)(packet_buffer);
  memcpy(packet_buffer,"\x24\x02\x04\xee\0\0\x29\x2c\0\0\x04\x4f\x11\x48\x85\x36\xca\xc2\x2f\xc7\x2a\x03\x92\x5b\0\0\0\0\0\0\0\0\xca\xc2\x30\x3c\xf5\x0a\xcc\x0b\xca\xc2\x30\x3c\xf5\x0f\x62\x73",48);
  uint32_t timestamp = ((packet_buffer[40] << 24) + (packet_buffer[41] << 16) + (packet_buffer[42] << 8) + (packet_buffer[43]));
  Serial.print("Machine Endian: ");
  Serial.println(variable[10],DEC);
  Serial.println(variable[10],HEX);
  Serial.print("Big Endian: ");
  Serial.println(timestamp,DEC);
  Serial.println(timestamp,HEX);
}
void loop() {
  
}

Hi,

since NTP-Clients are usally tied to a network-layer, the use Network-(i.e. Big Endian) byteorder anyway. Eberhard

Since the AVR doesn't have any registers over 8 bits, it doesn't really have a native endianness. (hmm. Check Data sheet. The AVR has Two instructions ADIW and SUBIW, that operate on "register pairs" in a manner that is blatantly little endian. Sort of, since those only work on register address space, and "endianness" usually refers to what happens when you copy data larger than a byte from memory to register(s)) However, the compiler certainly has an endianness that it uses for moving ints and longs to and from memory, even if the processor is agnostic. GCC (used by Arduino) seems to be little-endian by default. There IS a compiler switch you can use to specify endianness on cpus that can operate either way, but I don't know whether it does anything on AVRs...)