[android-developers] Re: How to get System Endianess
On Mar 19, 6:57 am, Luca Belluccini lucabellucc...@gmail.com wrote: In Sun Java I can get System endianess using the System.getProperty (sun.os.endian). How to get endianess of the system in Android? One possibility: java.nio.ByteOrder.nativeOrder(). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: How to get System Endianess
Thanks, but I think it is the java virtual machine byte order. I am communicating to/from low level stuff (kernel driver). On 19 Mar, 15:45, fadden fad...@android.com wrote: On Mar 19, 6:57 am, Luca Belluccini lucabellucc...@gmail.com wrote: In Sun Java I can get System endianess using the System.getProperty (sun.os.endian). How to get endianess of the system in Android? One possibility: java.nio.ByteOrder.nativeOrder(). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: How to get System Endianess
well, assuming you code in C: int n = 1; char *p = (char*)n; int little_endian = *p == 1; does that help? On Thu, Mar 19, 2009 at 8:09 PM, Luca Belluccini lucabellucc...@gmail.com wrote: Thanks, but I think it is the java virtual machine byte order. I am communicating to/from low level stuff (kernel driver). On 19 Mar, 15:45, fadden fad...@android.com wrote: On Mar 19, 6:57 am, Luca Belluccini lucabellucc...@gmail.com wrote: In Sun Java I can get System endianess using the System.getProperty (sun.os.endian). How to get endianess of the system in Android? One possibility: java.nio.ByteOrder.nativeOrder(). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: How to get System Endianess
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 -~--~~~~--~~--~--~---