EmbLogic's Blog

how to know your system is little endian or big endian………..?

ARM processors could work in both modes either little and big endian.

In the ARM9TDMI, it works as  “BIGEND” that can be set (0 or 1) for instruction and data fetches…but only affect 16bit or 8bit fetches, while leaving the 32-bit word access unaffected.

4 Responses to how to know your system is little endian or big endian………..?

  1. Mandeesh Singh says:

    It’s entirely dependent on the Processor architecture.
    Commonly used Examples : -
    Big Endian : Motorola 6800, IBM Power
    Little Endian :x86, x86-64, 8051 etc
    Well just to share more. There’s another category that is : Bi-Endian which can behave as either of the two categories mentioned above. Most Important example is ARM, Power PC or MIPS.

    • spatlou says:

      ARM processors could work in both modes either little and big endian.
      In the ARM9TDMI, the “BIGEND” can be set (0 or 1) for instruction and data fetches…but only affect 16bit or 8bit fetches, while leaving the 32-bit word access unaffected.

  2. Thaks to every one but
    i want the c program that show the system architecture is little or big endian

  3. kamran says:

    For little endian lower-order byte of the number is stored in memory at the lowest address and for big endian higher-order byte is stored at lowest address.

    #include
    #define BIG_ENDIAN 0
    #define LITTLE_ENDIAN 1

    int main()
    {
    int value;
    value = endian();
    if (value == 1)
    printf(“Little endian\n”);
    else
    printf(“big endian\n”);
    return 0;
    }

    int endian() {
    short int word = 0×0001;
    char *byte = (char *) &word;
    return (byte[0] ? LITTLE_ENDIAN : BIG_ENDIAN);
    }

Leave a Reply to Kuldeep Dhanotia Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>