On Tue, Feb 24, 2015 at 2:11 AM, <[email protected]> wrote: > The DevTools team need to log some telemetry about whether the current > Firefox build is 32 or 64-bit. > > I was told to use XPCOMABI but the possible results are x86, x86_64, > ia_64, ppc, SPARC, Alpha or ARM. > > The problem is that early mac versions were 32-bit so assuming ppc is > 64-bit is not accurate. Most cellphones that have an ARM processor are > 32-bit but not all. There are similar issues with SPARC and Alpha. > > Does anybody know a reliable way to detect a 32 or 64-bit build? I am > happy to extend XPCOMABI if that is what it takes. > > Here is the current unreliable code: > > + _getIs64Bits: function() { > + let appInfo = Cc["@mozilla.org/xre/app-info;1 > "].getService(Ci.nsIXULAppInfo); > + > + let processor = appInfo.XPCOMABI.split("-")[0]; > + > + switch (processor) { > + case "x86": > + return 0; // 32-bit > + case "x86_64": > + case "ia_64": > + case "ppc": > + return 1; // 64-bit > + } > + > + return 2; // Unknown - SPARC, Alpha or ARM. > + }, > > /Mike > _______________________________________________ > dev-platform mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-platform >
Assuming you just want to know what the architecture of the build is, not what the architecture of the machine it's running on is, you're making this far more complicated than it needs to be. "x86", "arm", and "ppc" are 32 bit, "x86_64" and "aarch64" are 64 bit. I'm not sure why you care about 64 bit PowerPC, since afaik we never shipped a release on it, but it will be "ppc64". I'm also not sure why you care about arcane architectures like Itanium, Alpha, and SPARC, since there are approximately zero users of those. - Kyle _______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform

