Home / Function/ decodeULE128() — netty Function Reference

decodeULE128() — netty Function Reference

Architecture documentation for the decodeULE128() function in HpackDecoderULE128Benchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4c045bd6_da32_a2da_b609_246be602d082["decodeULE128()"]
  de40d68e_4a6c_694e_c920_73882d2bb6c0["HpackDecoderULE128Benchmark"]
  4c045bd6_da32_a2da_b609_246be602d082 -->|defined in| de40d68e_4a6c_694e_c920_73882d2bb6c0
  0717d033_95e3_63d9_c72a_27848976905b["decodeMaxLong()"]
  0717d033_95e3_63d9_c72a_27848976905b -->|calls| 4c045bd6_da32_a2da_b609_246be602d082
  b980840d_6eff_4de1_17c7_deeba7582a9a["decodeMaxIntWithLong()"]
  b980840d_6eff_4de1_17c7_deeba7582a9a -->|calls| 4c045bd6_da32_a2da_b609_246be602d082
  65c9c689_5b46_4739_5e08_b7862776759d["decodeMaxInt()"]
  65c9c689_5b46_4739_5e08_b7862776759d -->|calls| 4c045bd6_da32_a2da_b609_246be602d082
  380d7ceb_df2a_c296_08fd_47d51f945cda["decodeULE128UsingLong()"]
  380d7ceb_df2a_c296_08fd_47d51f945cda -->|calls| 4c045bd6_da32_a2da_b609_246be602d082
  style 4c045bd6_da32_a2da_b609_246be602d082 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/handler/codec/http2/HpackDecoderULE128Benchmark.java lines 103–128

    static long decodeULE128(ByteBuf in, long result) throws Http2Exception {
        assert result <= 0x7f && result >= 0;
        final boolean resultStartedAtZero = result == 0;
        final int writerIndex = in.writerIndex();
        for (int readerIndex = in.readerIndex(), shift = 0; readerIndex < writerIndex; ++readerIndex, shift += 7) {
            byte b = in.getByte(readerIndex);
            if (shift == 56 && ((b & 0x80) != 0 || b == 0x7F && !resultStartedAtZero)) {
                // the maximum value that can be represented by a signed 64 bit number is:
                // [0x01L, 0x7fL] + 0x7fL + (0x7fL << 7) + (0x7fL << 14) + (0x7fL << 21) + (0x7fL << 28) + (0x7fL << 35)
                // + (0x7fL << 42) + (0x7fL << 49) + (0x7eL << 56)
                // OR
                // 0x0L + 0x7fL + (0x7fL << 7) + (0x7fL << 14) + (0x7fL << 21) + (0x7fL << 28) + (0x7fL << 35) +
                // (0x7fL << 42) + (0x7fL << 49) + (0x7fL << 56)
                // this means any more shifts will result longMaxBuf overflow so we should break out and throw an error.
                throw DECODE_ULE_128_TO_LONG_DECOMPRESSION_EXCEPTION;
            }

            if ((b & 0x80) == 0) {
                in.readerIndex(readerIndex + 1);
                return result + ((b & 0x7FL) << shift);
            }
            result += (b & 0x7FL) << shift;
        }

        throw DECODE_ULE_128_DECOMPRESSION_EXCEPTION;
    }

Domain

Subdomains

Frequently Asked Questions

What does decodeULE128() do?
decodeULE128() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/handler/codec/http2/HpackDecoderULE128Benchmark.java.
Where is decodeULE128() defined?
decodeULE128() is defined in microbench/src/main/java/io/netty/handler/codec/http2/HpackDecoderULE128Benchmark.java at line 103.
What calls decodeULE128()?
decodeULE128() is called by 4 function(s): decodeMaxInt, decodeMaxIntWithLong, decodeMaxLong, decodeULE128UsingLong.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free