From c778f11eef29341facba6fce9a40cc0368e1b957 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 15 Jul 2024 08:59:23 -0700 Subject: [PATCH] QH2Connection: store the BitPatterns as constexpr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unlike Clang, GCC does not automatically emit them as constexpr with just "const" declaration. $ nm -C lib64/libQt6Network.so.6.9.0 | grep -F 'HPack::(' 00000000001dc376 r HPack::(anonymous namespace)::LiteralNoIndexing 00000000001dc374 r HPack::(anonymous namespace)::LiteralNeverIndexing 00000000001dc480 r HPack::(anonymous namespace)::staticHuffmanCodeTable 00000000001dc378 r HPack::(anonymous namespace)::LiteralIncrementalIndexing 00000000001dc37a r HPack::(anonymous namespace)::Indexed Pick-to: 6.7 6.5 Change-Id: I398f9e3d83d44f198a69fffd17e26e30b9bce7ed Reviewed-by: Lena Biliaieva Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit c607a3894c39a2c5a35e9d474b233637a6f55cc7) Reviewed-by: Qt Cherry-pick Bot --- src/network/access/http2/hpack.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/network/access/http2/hpack.cpp b/src/network/access/http2/hpack.cpp index ee3cdeb27ab..d5f541ed28c 100644 --- a/src/network/access/http2/hpack.cpp +++ b/src/network/access/http2/hpack.cpp @@ -54,11 +54,11 @@ using StreamError = BitIStream::Error; // It's always 1 or 0 actually, but the number of bits to extract // from the input stream - differs. -const BitPattern Indexed = {1, 1}; -const BitPattern LiteralIncrementalIndexing = {1, 2}; -const BitPattern LiteralNoIndexing = {0, 4}; -const BitPattern LiteralNeverIndexing = {1, 4}; -const BitPattern SizeUpdate = {1, 3}; +constexpr BitPattern Indexed = {1, 1}; +constexpr BitPattern LiteralIncrementalIndexing = {1, 2}; +constexpr BitPattern LiteralNoIndexing = {0, 4}; +constexpr BitPattern LiteralNeverIndexing = {1, 4}; +constexpr BitPattern SizeUpdate = {1, 3}; bool is_literal_field(BitPattern pattern) {