Update CircularBuffer

This commit is contained in:
shogo4405 2020-01-13 22:57:11 +09:00
parent f306814bb0
commit 7ca421e5ed
1 changed files with 2 additions and 3 deletions

View File

@ -19,7 +19,7 @@ struct CircularBuffer<Element> {
}
var isFull: Bool {
return count == mask + 1
count == mask + 1
}
private var top: Int = 0
@ -72,8 +72,7 @@ struct CircularBuffer<Element> {
bottom = count
buffer.append(contentsOf: [Element?](repeating: nil, count: buffer.count))
mask = buffer.count - 1
buffer.append(newElement)
return true
return append(newElement)
}
}