-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.swift
41 lines (32 loc) · 987 Bytes
/
Main.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var myArrayA: [Float32] = [1.0, 2.0, 3.0, 4.0]
var myArrayB: [Float32] = [10.0, 20.0, 30.0, 40.0]
var myArray: [Float32] = [0.0, 0.0, 0.0, 0.0]
@main
struct Main {
static func main() {
myArrayA.withUnsafeMutableBufferPointer { bufA in
myArrayB.withUnsafeMutableBufferPointer { bufB in
myArray.withUnsafeMutableBufferPointer { buf in
guard let addrA = bufA.baseAddress else {
print("Failed to get a valid base address.")
return
}
guard let addrB = bufB.baseAddress else {
print("Failed to get a valid base address.")
return
}
guard let addr = buf.baseAddress else {
print("Failed to get a valid base address.")
return
}
arm_add_f32(addrA,addrB,addr,UInt32(myArrayA.count))
for x: Float32 in myArray
{
printFloat(Float32(x))
}
}
}
}
print("Hello world with Helium")
}
}