Update pod RxSwift, RxCocoa to 4.5.0
This commit is contained in:
24
Pods/RxCocoa/Platform/DataStructures/Bag.swift
generated
24
Pods/RxCocoa/Platform/DataStructures/Bag.swift
generated
@ -25,7 +25,7 @@ Data structure that represents a bag of elements typed `T`.
|
||||
|
||||
Single element can be stored multiple times.
|
||||
|
||||
Time and space complexity of insertion an deletion is O(n).
|
||||
Time and space complexity of insertion and deletion is O(n).
|
||||
|
||||
It is suitable for storing small number of elements.
|
||||
*/
|
||||
@ -40,14 +40,14 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
// data
|
||||
|
||||
// first fill inline variables
|
||||
var _key0: BagKey? = nil
|
||||
var _value0: T? = nil
|
||||
var _key0: BagKey?
|
||||
var _value0: T?
|
||||
|
||||
// then fill "array dictionary"
|
||||
var _pairs = ContiguousArray<Entry>()
|
||||
|
||||
// last is sparse dictionary
|
||||
var _dictionary: [BagKey : T]? = nil
|
||||
var _dictionary: [BagKey: T]?
|
||||
|
||||
var _onlyFastPath = true
|
||||
|
||||
@ -122,12 +122,10 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
return existingObject
|
||||
}
|
||||
|
||||
for i in 0 ..< _pairs.count {
|
||||
if _pairs[i].key == key {
|
||||
let value = _pairs[i].value
|
||||
_pairs.remove(at: i)
|
||||
return value
|
||||
}
|
||||
for i in 0 ..< _pairs.count where _pairs[i].key == key {
|
||||
let value = _pairs[i].value
|
||||
_pairs.remove(at: i)
|
||||
return value
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -173,9 +171,15 @@ extension Bag {
|
||||
}
|
||||
|
||||
extension BagKey: Hashable {
|
||||
#if swift(>=4.2)
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(rawValue)
|
||||
}
|
||||
#else
|
||||
var hashValue: Int {
|
||||
return rawValue.hashValue
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
func ==(lhs: BagKey, rhs: BagKey) -> Bool {
|
||||
|
@ -52,11 +52,7 @@ struct PriorityQueue<Element> {
|
||||
private mutating func removeAt(_ index: Int) {
|
||||
let removingLast = index == _elements.count - 1
|
||||
if !removingLast {
|
||||
#if swift(>=3.2)
|
||||
_elements.swapAt(index, _elements.count - 1)
|
||||
#else
|
||||
swap(&_elements[index], &_elements[_elements.count - 1])
|
||||
#endif
|
||||
}
|
||||
|
||||
_ = _elements.popLast()
|
||||
@ -76,11 +72,7 @@ struct PriorityQueue<Element> {
|
||||
while unbalancedIndex > 0 {
|
||||
let parentIndex = (unbalancedIndex - 1) / 2
|
||||
guard _hasHigherPriority(_elements[unbalancedIndex], _elements[parentIndex]) else { break }
|
||||
#if swift(>=3.2)
|
||||
_elements.swapAt(unbalancedIndex, parentIndex)
|
||||
#else
|
||||
swap(&_elements[unbalancedIndex], &_elements[parentIndex])
|
||||
#endif
|
||||
unbalancedIndex = parentIndex
|
||||
}
|
||||
}
|
||||
@ -105,12 +97,8 @@ struct PriorityQueue<Element> {
|
||||
}
|
||||
|
||||
guard highestPriorityIndex != unbalancedIndex else { break }
|
||||
|
||||
#if swift(>=3.2)
|
||||
_elements.swapAt(highestPriorityIndex, unbalancedIndex)
|
||||
#else
|
||||
swap(&_elements[highestPriorityIndex], &_elements[unbalancedIndex])
|
||||
#endif
|
||||
|
||||
unbalancedIndex = highestPriorityIndex
|
||||
}
|
||||
}
|
||||
|
34
Pods/RxCocoa/Platform/Platform.Darwin.swift
generated
34
Pods/RxCocoa/Platform/Platform.Darwin.swift
generated
@ -10,34 +10,10 @@
|
||||
|
||||
import Darwin
|
||||
import class Foundation.Thread
|
||||
import func Foundation.OSAtomicCompareAndSwap32Barrier
|
||||
import func Foundation.OSAtomicIncrement32Barrier
|
||||
import func Foundation.OSAtomicDecrement32Barrier
|
||||
import protocol Foundation.NSCopying
|
||||
|
||||
typealias AtomicInt = Int32
|
||||
|
||||
fileprivate func castToUInt32Pointer(_ pointer: UnsafeMutablePointer<Int32>) -> UnsafeMutablePointer<UInt32> {
|
||||
let raw = UnsafeMutableRawPointer(pointer)
|
||||
return raw.assumingMemoryBound(to: UInt32.self)
|
||||
}
|
||||
|
||||
let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier
|
||||
let AtomicIncrement = OSAtomicIncrement32Barrier
|
||||
let AtomicDecrement = OSAtomicDecrement32Barrier
|
||||
func AtomicOr(_ mask: UInt32, _ theValue : UnsafeMutablePointer<Int32>) -> Int32 {
|
||||
return OSAtomicOr32OrigBarrier(mask, castToUInt32Pointer(theValue))
|
||||
}
|
||||
func AtomicFlagSet(_ mask: UInt32, _ theValue : UnsafeMutablePointer<Int32>) -> Bool {
|
||||
// just used to create a barrier
|
||||
OSAtomicXor32OrigBarrier(0, castToUInt32Pointer(theValue))
|
||||
return (theValue.pointee & Int32(mask)) != 0
|
||||
}
|
||||
|
||||
extension Thread {
|
||||
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: NSCopying
|
||||
) {
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: NSCopying) {
|
||||
let currentThread = Thread.current
|
||||
let threadDictionary = currentThread.threadDictionary
|
||||
|
||||
@ -47,8 +23,8 @@
|
||||
else {
|
||||
threadDictionary[key] = nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static func getThreadLocalStorageValueForKey<T>(_ key: NSCopying) -> T? {
|
||||
let currentThread = Thread.current
|
||||
let threadDictionary = currentThread.threadDictionary
|
||||
@ -57,10 +33,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
extension AtomicInt {
|
||||
func valueSnapshot() -> Int32 {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
68
Pods/RxCocoa/Platform/Platform.Linux.swift
generated
68
Pods/RxCocoa/Platform/Platform.Linux.swift
generated
@ -8,76 +8,8 @@
|
||||
|
||||
#if os(Linux)
|
||||
|
||||
import XCTest
|
||||
import Glibc
|
||||
import SwiftShims
|
||||
import class Foundation.Thread
|
||||
|
||||
final class AtomicInt {
|
||||
typealias IntegerLiteralType = Int
|
||||
fileprivate var value: Int32 = 0
|
||||
fileprivate var _lock = RecursiveLock()
|
||||
|
||||
func lock() {
|
||||
_lock.lock()
|
||||
}
|
||||
func unlock() {
|
||||
_lock.unlock()
|
||||
}
|
||||
|
||||
func valueSnapshot() -> Int32 {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
extension AtomicInt: ExpressibleByIntegerLiteral {
|
||||
convenience init(integerLiteral value: Int) {
|
||||
self.init()
|
||||
self.value = Int32(value)
|
||||
}
|
||||
}
|
||||
|
||||
func >(lhs: AtomicInt, rhs: Int32) -> Bool {
|
||||
return lhs.value > rhs
|
||||
}
|
||||
func ==(lhs: AtomicInt, rhs: Int32) -> Bool {
|
||||
return lhs.value == rhs
|
||||
}
|
||||
|
||||
func AtomicFlagSet(_ mask: UInt32, _ atomic: inout AtomicInt) -> Bool {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
return (atomic.value & Int32(mask)) != 0
|
||||
}
|
||||
|
||||
func AtomicOr(_ mask: UInt32, _ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
let value = atomic.value
|
||||
atomic.value |= Int32(mask)
|
||||
return value
|
||||
}
|
||||
|
||||
func AtomicIncrement(_ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
atomic.value += 1
|
||||
return atomic.value
|
||||
}
|
||||
|
||||
func AtomicDecrement(_ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
atomic.value -= 1
|
||||
return atomic.value
|
||||
}
|
||||
|
||||
func AtomicCompareAndSwap(_ l: Int32, _ r: Int32, _ atomic: inout AtomicInt) -> Bool {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
if atomic.value == l {
|
||||
atomic.value = r
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
extension Thread {
|
||||
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: String) {
|
||||
|
Reference in New Issue
Block a user