@@ -437,6 +437,16 @@ struct GenericSignatureLayout {
437
437
const GenericSignatureLayout<Runtime> &rhs) {
438
438
return !(lhs == rhs);
439
439
}
440
+
441
+ int compare (const GenericSignatureLayout<Runtime> &rhs) const {
442
+ if (auto result = compareIntegers (NumKeyParameters, rhs.NumKeyParameters ))
443
+ return result;
444
+
445
+ if (auto result = compareIntegers (NumWitnessTables, rhs.NumWitnessTables ))
446
+ return result;
447
+
448
+ return 0 ;
449
+ }
440
450
};
441
451
442
452
// / A key value as provided to the concurrent map.
@@ -521,7 +531,7 @@ class MetadataCacheKey {
521
531
// Compare the hashes.
522
532
if (hash () != rhs.hash ()) return false ;
523
533
524
- // Compare the sizes .
534
+ // Compare the layouts .
525
535
if (Layout != rhs.Layout ) return false ;
526
536
527
537
// Compare the content.
@@ -530,23 +540,12 @@ class MetadataCacheKey {
530
540
531
541
int compare (const MetadataCacheKey &rhs) const {
532
542
// Compare the hashes.
533
- if (auto hashComparison = compareIntegers (Hash, rhs.Hash )) {
534
- return hashComparison;
535
- }
536
-
537
- // Compare the # of key parameters.
538
- if (auto keyParamsComparison =
539
- compareIntegers (Layout.NumKeyParameters ,
540
- rhs.Layout .NumKeyParameters )) {
541
- return keyParamsComparison;
542
- }
543
+ if (auto result = compareIntegers (Hash, rhs.Hash ))
544
+ return result;
543
545
544
- // Compare the # of witness tables.
545
- if (auto witnessTablesComparison =
546
- compareIntegers (Layout.NumWitnessTables ,
547
- rhs.Layout .NumWitnessTables )) {
548
- return witnessTablesComparison;
549
- }
546
+ // Compare the layouts.
547
+ if (auto result = Layout.compare (rhs.Layout ))
548
+ return result;
550
549
551
550
// Compare the content.
552
551
return compareContent (begin (), rhs.begin (), Layout);
0 commit comments