We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e46929a + a29a594 commit bf1840dCopy full SHA for bf1840d
Tests/POSIXTests/ReaddirTests.swift
@@ -12,6 +12,12 @@ import XCTest
12
13
import POSIX
14
15
+extension MemoryLayout {
16
+ fileprivate static func ofInstance(_: @autoclosure () -> T) -> MemoryLayout<T>.Type {
17
+ return MemoryLayout<T>.self
18
+ }
19
+}
20
+
21
class ReaddirTests: XCTestCase {
22
func testName() {
23
do {
@@ -38,7 +44,7 @@ class ReaddirTests: XCTestCase {
38
44
39
45
40
46
var s = dirent()
41
- let n = sizeof(s.d_name.dynamicType)
47
+ let n = MemoryLayout.ofInstance(s.d_name).size
42
48
withUnsafeMutablePointer(to: &s.d_name) { ptr in
43
49
let ptr = unsafeBitCast(ptr, to: UnsafeMutablePointer<UInt8>.self)
50
for i in 0 ..< n {
0 commit comments