有没有办法在运行时在 iOS 上检测 VFP/NEON/Thumb/...? [英] Is there a way to detect VFP/NEON/Thumb/... on iOS at runtime?

查看:32
本文介绍了有没有办法在运行时在 iOS 上检测 VFP/NEON/Thumb/...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以通过查询sysctlbyname("hw.cpusubtype", ...),很容易确定iOS设备运行的CPU类型,但似乎没有明显的方法来计算了解 CPU 实际具有的功能(想想 VFP、NEON、Thumb 等).有人能想出办法做到这一点吗?

So it's fairly easy to figure out what kind of CPU an iOS device runs by querying sysctlbyname("hw.cpusubtype", ...), but there seems to be no obvious way to figure out what features the CPU actually has (think VFP, NEON, Thumb, ...). Can someone think of a way to do this?

基本上,我需要的是类似于 Linux/Android 上的 getauxval(AT_HWCAP) 的东西,它返回 CPU 支持的功能的位掩码.

Basically, what I need is something similar to getauxval(AT_HWCAP) on Linux/Android, which returns a bit mask of features supported by the CPU.

需要注意的几点:

  1. 信息必须在运行时从操作系统中检索.没有预处理器定义.
  2. 胖二进制文件不是解决方案.我真的确实需要了解 ARM v6 二进制文件中的这些内容.
  1. The information must be retrieved at runtime from the OS. No preprocessor defines.
  2. Fat binaries is not a solution. I really do need to know this stuff in an ARM v6 binary.

提前致谢!

推荐答案

sysctlbyname 有hw.optional.neon".我没有看到 VFP 的名称,除了hw.optional.vfp_shortvector",这是一个已弃用的功能.

sysctlbyname has "hw.optional.neon". I do not see a name for VFP, except "hw.optional.vfp_shortvector", which is a deprecated feature.

这篇关于有没有办法在运行时在 iOS 上检测 VFP/NEON/Thumb/...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆