Skip to content

error: use of unresolved identifier 'benchmark' #4

@kechan

Description

@kechan

Must be something basic I am missing. Here's my Package.swift:

import PackageDescription

let package = Package(
name: "TestBasemath",
dependencies: [
.package(url: "https://github.com/jph00/BaseMath.git", from: "1.0.0"),
],
targets: [

    .target(
        name: "TestBasemath",
        dependencies: ["BaseMath"]),
    .testTarget(
        name: "TestBasemathTests",
        dependencies: ["TestBasemath"]),
]

)

Here's my quick test code:

import BaseMath

print("Hello, world!")

let ar1 = [1.0, 2.0, 3.0]
let ar2 = [0.0, 0.0, 0.0]

benchmark(title:"swift ptr add") {
let (p1, p2) = (ar1.p, ar2.p)
for i in 0..<ar1.count {
p2[i] = p1[i] + 2.0
}
}

Note that if I just remove the benchmark, the for loop will run without error. This mean the Float or Double is understanding .p is supposed to return the raw pointer. I am not sure why it isn't resolving the benchmark func defined in Utils.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions