[Spice-devel] [PATCH spice-common] quic: Use G_UNLIKELY in some hot paths
Frediano Ziglio
fziglio at redhat.com
Fri Oct 18 16:08:25 UTC 2019
The buffers provided should be big enough to avoid to ask
for more space much often.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
common/quic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/quic.c b/common/quic.c
index e1c439f..d24a0f6 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -396,7 +396,7 @@ static void more_io_words(Encoder *encoder)
static inline void write_io_word(Encoder *encoder)
{
- if (encoder->io_now == encoder->io_end) {
+ if (G_UNLIKELY(encoder->io_now == encoder->io_end)) {
more_io_words(encoder);
}
*(encoder->io_now++) = GUINT32_TO_LE(encoder->io_word);
@@ -444,7 +444,7 @@ static inline void flush(Encoder *encoder)
static inline void read_io_word(Encoder *encoder)
{
- if (encoder->io_now == encoder->io_end) {
+ if (G_UNLIKELY(encoder->io_now == encoder->io_end)) {
more_io_words(encoder);
}
if (spice_extra_checks) {
--
2.21.0
More information about the Spice-devel
mailing list