Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What percentage of Android phones are little-endian?

edit: This is different from Endianness of Android NDK because that question asks how to find the endianness, not how many devices are big/little-endian. Mods, please don't mark this as a dupe.


Just curious, is it worthwhile to support both big/little-endian Android phones? I have some code in my app that's endian-sensitive, for those of you who are curious it involves serializing a long to a byte stream. I think my phone is big-endian because ByteBuffer.getLong() is reading in a big-endian fashion from the byte stream I've written to.

Is it worthwhile to support big/little-endian Android phones? I'm not sure how common big-endian is compared to little-endian. Is there data available that tells us the relative percentages of each?

Thanks.

like image 654
James Ko Avatar asked Jan 29 '23 23:01

James Ko


1 Answers

Almost all of the supported architectures are little-endian, with one possible exception.

Android lists its supported ABIs (Application Binary Interfaces) here. There are essentially three categories:

  • ARM-based; and for those the page says the each "follows the little-endian ARM GNU/Linux ABI."
  • x86-based; and those are all little-endian
  • mips-based; the page specifies that standard mips is little-endian. It doesn't say anything about mips64 other than linking to its official page

So mips64 is the only question mark. It supports a bi-endian architecture. It seems the first mips64 smartphone chips came out in 2016. I couldn't find which (if any) phones actually use this, but it doesn't seem to be very common.

As to whether it's worthwhile to support both: that's a judgement call you'll have to make. Who knows what the future will bring?

like image 127
yshavit Avatar answered Feb 02 '23 11:02

yshavit