Pergunta de entrevista da empresa Dolby

Write a program to test endianess of storage.

Respostas da entrevista

Sigiloso

4 de dez. de 2012

#define LITTLE_ENDIAN 0 #define BIG_ENDIAN 1 int EndiannessTest() { int i = 1; char *p = (char *) &i; if (p[0] == 1) // Lowest address contains the least significant byte return LITTLE_ENDIAN; else return BIG_ENDIAN; }

10

Sigiloso

17 de abr. de 2011

I described a method that placed a 1 byte word into a 2 byte address. If the word was matched in the upper MSB, it was Big endian, otherwise small endian.

1

Sigiloso

16 de jul. de 2011

use union property to judge if it is big endian or little endian.

3