Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: net/quic/core/quic_bandwidth.h

Issue 2309603002: Round results of multiplying QuicBandwidth and QuicTime::Delta rather than truncating. No behavior… (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/congestion_control/rtt_stats_test.cc ('k') | net/quic/core/quic_bandwidth_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_bandwidth.h
diff --git a/net/quic/core/quic_bandwidth.h b/net/quic/core/quic_bandwidth.h
index 7a8b55d8dbaa5ddd6b65442f8f69a080255fc661..2d131d277ed826fb5e84327a0f239c1868c7de55 100644
--- a/net/quic/core/quic_bandwidth.h
+++ b/net/quic/core/quic_bandwidth.h
@@ -9,6 +9,7 @@
#include <stdint.h>
+#include <cmath>
#include <ostream>
#include "base/compiler_specific.h"
@@ -98,7 +99,8 @@ inline QuicBandwidth operator-(QuicBandwidth lhs, QuicBandwidth rhs) {
return QuicBandwidth(lhs.bits_per_second_ - rhs.bits_per_second_);
}
inline QuicBandwidth operator*(QuicBandwidth lhs, float rhs) {
- return QuicBandwidth(static_cast<int64_t>(lhs.bits_per_second_ * rhs));
+ return QuicBandwidth(
+ static_cast<int64_t>(std::llround(lhs.bits_per_second_ * rhs)));
}
inline QuicBandwidth operator*(float lhs, QuicBandwidth rhs) {
return rhs * lhs;
« no previous file with comments | « net/quic/core/congestion_control/rtt_stats_test.cc ('k') | net/quic/core/quic_bandwidth_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698