Skip to content

Commit 7efb2d1

Browse files
authored
Merge pull request #12246 from linux-on-ibm-z/swift40-URBPTest-fix
[stdlib] Fix for initFromArray test on big endian (4.0)
2 parents 51173d9 + 3ac3c9c commit 7efb2d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/stdlib/UnsafeRawBufferPointer.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ UnsafeRawBufferPointerTestSuite.test("initFromArray") {
6666
array1.withUnsafeBytes { bytes1 in
6767
expectEqual(bytes1.count, 16)
6868
for (i, b) in bytes1.enumerated() {
69-
if i % 4 == 0 {
69+
var num = i
70+
#if _endian(big)
71+
num = num + 1
72+
#endif
73+
if num % 4 == 0 {
7074
expectEqual(Int(b), i / 4)
7175
}
7276
else {

0 commit comments

Comments
 (0)