可以用 Swift 编写汇编吗?我对此很好奇。像这样的:__asm__
这在 C 等语言中是可能的。
我在 Swift 中找不到任何关于此的信息。
最佳答案
不,如果你想要这样做,你可以在 Objective C 中执行此操作,并使用桥接 header 将你的 Objective-C 代码公开给 Swift。 Objective-C 代码:
inline void assemblyFunc() {
__asm__(/*Assembly*/);
}
How to call Objective-C code from Swift
我也在这里问过这个问题:Is it possible to write inline assembly in Swift?
关于swift - 如何用swift编写汇编,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24767455/