Minor fixes.
GitOrigin-RevId: 39fb006dd5d935f6dd0b400114d71391463450eb
This commit is contained in:
parent
f9a0b34cb2
commit
b5407cd6bc
@ -21,7 +21,6 @@
|
||||
#include "td/telegram/StateManager.h"
|
||||
#include "td/telegram/TdDb.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/TdParameters.h"
|
||||
#include "td/telegram/UpdatesManager.h"
|
||||
|
||||
#include "td/db/binlog/BinlogEvent.h"
|
||||
@ -335,7 +334,7 @@ vector<int32> PollManager::get_vote_percentage(const vector<int32> &voter_counts
|
||||
// just round to the nearest
|
||||
for (size_t i = 0; i < result.size(); i++) {
|
||||
result[i] =
|
||||
static_cast<int32>((static_cast<int64_t>(voter_counts[i]) * 200 + total_voter_count) / total_voter_count / 2);
|
||||
static_cast<int32>((static_cast<int64>(voter_counts[i]) * 200 + total_voter_count) / total_voter_count / 2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -344,10 +343,10 @@ vector<int32> PollManager::get_vote_percentage(const vector<int32> &voter_counts
|
||||
int32 percent_sum = 0;
|
||||
vector<int32> gap(voter_counts.size(), 0);
|
||||
for (size_t i = 0; i < result.size(); i++) {
|
||||
auto multiplied_voter_count = static_cast<int64_t>(voter_counts[i]) * 100;
|
||||
auto multiplied_voter_count = static_cast<int64>(voter_counts[i]) * 100;
|
||||
result[i] = static_cast<int32>(multiplied_voter_count / total_voter_count);
|
||||
CHECK(0 <= result[i] && result[i] <= 100);
|
||||
gap[i] = static_cast<int32>(static_cast<int64_t>(result[i] + 1) * total_voter_count - multiplied_voter_count);
|
||||
gap[i] = static_cast<int32>(static_cast<int64>(result[i] + 1) * total_voter_count - multiplied_voter_count);
|
||||
CHECK(0 <= gap[i] && gap[i] <= total_voter_count);
|
||||
percent_sum += result[i];
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
#include "td/telegram/QueryCombiner.h"
|
||||
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/Time.h"
|
||||
|
||||
namespace td {
|
||||
|
@ -10,8 +10,9 @@
|
||||
#include "td/actor/PromiseFuture.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/Slice.h"
|
||||
#include "td/utils/Status.h"
|
||||
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/misc.h"
|
||||
#include "td/utils/ScopeGuard.h"
|
||||
|
||||
#include <limits>
|
||||
#include <numeric>
|
||||
@ -225,9 +226,7 @@ bool PartsManager::is_part_in_streaming_limit(int part_i) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto is_intersect_with = [&](int64 begin, int64 end) {
|
||||
return std::max(begin, offset_begin) < std::min(end, offset_end);
|
||||
};
|
||||
auto is_intersect_with = [&](int64 begin, int64 end) { return max(begin, offset_begin) < min(end, offset_end); };
|
||||
|
||||
auto streaming_begin = streaming_offset_;
|
||||
auto streaming_end = streaming_offset_ + streaming_limit_;
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/Slice.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace td {
|
||||
|
||||
SessionMultiProxy::SessionMultiProxy() = default;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "td/telegram/net/DcId.h"
|
||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||
#include "td/telegram/net/Session.h"
|
||||
#include "td/telegram/UniqueId.h"
|
||||
|
||||
#include "td/actor/PromiseFuture.h"
|
||||
|
||||
|
Reference in New Issue
Block a user