On Mar 19, 2:07 pm, Stoyan Damov <stoyan.da...@gmail.com> wrote:
> int n = 1;
> char *p = (char*)&n;
> int little_endian = *p == 1;

If it's C you don't even need to booleanize it:

int isLittleEndian(void)
{
    /*static*/ short order = 0x0001;
    return *((char*) &order);
}

At any rate, the original poster was using System.getProperty before,
so I'm assume this is for code written in the Java programming
language.  ByteOrder.nativeOrder() is defined as: "Retrieves the
native byte order of the underlying platform."  There's no "virtual
machine byte order".

In android you can see that dalvik/libcore/nio/src/main/java/java/nio/
ByteOrder.java has a NATIVE_ORDER define that comes from
Platform.getMemorySystem().isLittleEndian(), which does something
similar to the above.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to