Optimize FullRemoteFileLocation::operator<.
This commit is contained in:
parent
247c28d6e7
commit
131d96bc04
@ -524,25 +524,17 @@ class FullRemoteFileLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const FullRemoteFileLocation &other) const {
|
bool operator<(const FullRemoteFileLocation &other) const {
|
||||||
auto lhs_key_type = key_type();
|
if (!(variant_ == other.variant_)) {
|
||||||
auto rhs_key_type = other.key_type();
|
return variant_ < other.variant_;
|
||||||
if (lhs_key_type != rhs_key_type) {
|
|
||||||
return lhs_key_type < rhs_key_type;
|
|
||||||
}
|
}
|
||||||
if (dc_id_ != other.dc_id_) {
|
if (file_type_ != other.file_type_) {
|
||||||
return dc_id_ < other.dc_id_;
|
return file_type_ < other.file_type_;
|
||||||
}
|
}
|
||||||
return variant_ < other.variant_;
|
return dc_id_ < other.dc_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const FullRemoteFileLocation &other) const {
|
bool operator==(const FullRemoteFileLocation &other) const {
|
||||||
if (key_type() != other.key_type()) {
|
return variant_ == other.variant_ && file_type_ == other.file_type_ && dc_id_ == other.dc_id_;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (dc_id_ != other.dc_id_) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return variant_ == other.variant_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 KEY_MAGIC = 0x64374632;
|
static const int32 KEY_MAGIC = 0x64374632;
|
||||||
|
@ -268,9 +268,9 @@ FileId FileManager::parse_file(ParserT &parser) {
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
if (has_encryption_key || has_secure_key) {
|
if (has_encryption_key || has_secure_key) {
|
||||||
auto key_type = has_encryption_key ? FileEncryptionKey::Type::Secret : FileEncryptionKey::Type::Secure;
|
auto encryption_key_type = has_encryption_key ? FileEncryptionKey::Type::Secret : FileEncryptionKey::Type::Secure;
|
||||||
FileEncryptionKey encryption_key;
|
FileEncryptionKey encryption_key;
|
||||||
encryption_key.parse(key_type, parser);
|
encryption_key.parse(encryption_key_type, parser);
|
||||||
set_encryption_key(file_id, std::move(encryption_key));
|
set_encryption_key(file_id, std::move(encryption_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user