Swift笔记 - 04.MemoryLayout 与 常用汇编指令

Swift笔记 - 04.MemoryLayout 与 常用汇编指令

MemoryLayout

enum Password {
case number(Int, Int, Int, Int)
case other
}

MemoryLayout<Password>.stride//40,分配占用的空间大小
MemoryLayout<Password>.size1/33实际用到的空间大小
MemoryLayout<Passwords.alignment//8,对齐参数

var age = 10

//MemoryLayout<Int>.size
//MemoryLayout<Int>.stride
//MemoryLayout<Int>.alignment

//MemoryLayout.size(ofValue: age)
//MemoryLayout.stride(ofValue: age)
//MemoryLayout.alignment(ofValue: age)
enum Password {
    case number (Int, Int, Int, Int) // 32
    case other // 1
}

var pwd = Password.number (5, 6, 4, 7) // 40
pwd = .other

MemoryLayout<Password>.size // 33
MemoryLayout<Password>.stride // 40
MemoryLayout<Password>.alignment // 8

汇编

常用的汇编指定

•有16个常用寄存器

•寄存器的具体用途

lldb常用指令

版权所有,转载请注明出处 luowei.github.io.