mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix warnings in benchmarks
This commit is contained in:
@@ -146,7 +146,7 @@ public func run_Dictionary(scale: Int) {
|
||||
"IncorrectResults in DictTest: \(count) != \(N*541).")
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
@@ -156,13 +156,10 @@ class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
var hashValue: Int {
|
||||
return value.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Box : Equatable {
|
||||
}
|
||||
|
||||
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -37,7 +37,7 @@ public func run_Dictionary2(_ N: Int) {
|
||||
CheckResults(res == ref_result, "Incorrect results in Dictionary2: \(res) != \(ref_result)")
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
@@ -47,13 +47,10 @@ class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
var hashValue: Int {
|
||||
return value.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Box : Equatable {
|
||||
}
|
||||
|
||||
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -44,7 +44,7 @@ public func run_Dictionary3(_ N: Int) {
|
||||
CheckResults(res == ref_result, "Incorrect results in Dictionary3: \(res) != \(ref_result)")
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public func run_DictionaryRemove(_ N: Int) {
|
||||
"tmpDict should be empty: \(tmpDict.count) != 0.")
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
@@ -52,13 +52,10 @@ class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
var hashValue: Int {
|
||||
return value.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Box : Equatable {
|
||||
}
|
||||
|
||||
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -45,7 +45,7 @@ func swappedCorrectly(_ swapped: Bool, _ p25: Int, _ p75: Int) -> Bool {
|
||||
!swapped && (p25 == 25 && p75 == 75)
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
@@ -55,13 +55,10 @@ class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
var hashValue: Int {
|
||||
return value.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Box : Equatable {
|
||||
}
|
||||
|
||||
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -92,9 +92,11 @@ func isCorrectHistogram(_ histogram: [(key: rrggbb_t, value: Int)]) -> Bool {
|
||||
histogram[156].0 == 0x003B8D96 && histogram[156].1 == 1
|
||||
}
|
||||
|
||||
func createSortedSparseRGBHistogram
|
||||
<S: Sequence where S.Iterator.Element == rrggbb_t>
|
||||
(_ samples: S) -> [(key: rrggbb_t, value: Int)] {
|
||||
func createSortedSparseRGBHistogram<S : Sequence>(
|
||||
_ samples: S
|
||||
) -> [(key: rrggbb_t, value: Int)]
|
||||
where S.Iterator.Element == rrggbb_t
|
||||
{
|
||||
var histogram = Dictionary<rrggbb_t, Int>()
|
||||
|
||||
for sample in samples {
|
||||
@@ -111,7 +113,7 @@ func createSortedSparseRGBHistogram
|
||||
}
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
@@ -121,13 +123,10 @@ class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
var hashValue: Int {
|
||||
return value.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Box : Equatable {
|
||||
}
|
||||
|
||||
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
func isCorrectHistogramOfObjects(_ histogram: [(key: Box<rrggbb_t>, value: Box<Int>)]) -> Bool {
|
||||
@@ -136,9 +135,11 @@ func isCorrectHistogramOfObjects(_ histogram: [(key: Box<rrggbb_t>, value: Box<I
|
||||
histogram[156].0.value == 0x003B8D96 && histogram[156].1.value == 1
|
||||
}
|
||||
|
||||
func createSortedSparseRGBHistogramOfObjects
|
||||
<S: Sequence where S.Iterator.Element == rrggbb_t>
|
||||
(_ samples: S) -> [(key: Box<rrggbb_t>, value: Box<Int>)] {
|
||||
func createSortedSparseRGBHistogramOfObjects<S : Sequence>(
|
||||
_ samples: S
|
||||
) -> [(key: Box<rrggbb_t>, value: Box<Int>)]
|
||||
where S.Iterator.Element == rrggbb_t
|
||||
{
|
||||
var histogram = Dictionary<Box<rrggbb_t>, Box<Int>>()
|
||||
|
||||
for sample in samples {
|
||||
|
||||
@@ -104,23 +104,20 @@ public func run_SetIntersect(_ N: Int) {
|
||||
sink(&and)
|
||||
}
|
||||
|
||||
class Box<T : Hashable where T : Equatable> : Hashable {
|
||||
class Box<T : Hashable> : Hashable {
|
||||
var value: T
|
||||
|
||||
init(_ v: T) {
|
||||
value = v
|
||||
}
|
||||
|
||||
var hashValue : Int {
|
||||
var hashValue: Int {
|
||||
return value.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
extension Box : Equatable {
|
||||
}
|
||||
|
||||
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
|
||||
return lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
Reference in New Issue
Block a user