Home / Function/ validateAndCalculatePageShifts() — netty Function Reference

validateAndCalculatePageShifts() — netty Function Reference

Architecture documentation for the validateAndCalculatePageShifts() function in PooledByteBufAllocator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  138d7a28_a452_624b_555e_672c231e03df["validateAndCalculatePageShifts()"]
  f5ea31b4_1e4c_94f0_32cf_d4ab3e538b0a["PooledByteBufAllocator"]
  138d7a28_a452_624b_555e_672c231e03df -->|defined in| f5ea31b4_1e4c_94f0_32cf_d4ab3e538b0a
  fd5b10b7_1fc6_6bf3_f94d_1c41e0794e60["PooledByteBufAllocator()"]
  fd5b10b7_1fc6_6bf3_f94d_1c41e0794e60 -->|calls| 138d7a28_a452_624b_555e_672c231e03df
  style 138d7a28_a452_624b_555e_672c231e03df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java lines 344–360

    private static int validateAndCalculatePageShifts(int pageSize, int alignment) {
        if (pageSize < MIN_PAGE_SIZE) {
            throw new IllegalArgumentException("pageSize: " + pageSize + " (expected: " + MIN_PAGE_SIZE + ')');
        }

        if ((pageSize & pageSize - 1) != 0) {
            throw new IllegalArgumentException("pageSize: " + pageSize + " (expected: power of 2)");
        }

        if (pageSize < alignment) {
            throw new IllegalArgumentException("Alignment cannot be greater than page size. " +
                    "Alignment: " + alignment + ", page size: " + pageSize + '.');
        }

        // Logarithm base 2. At this point we know that pageSize is a power of two.
        return Integer.SIZE - 1 - Integer.numberOfLeadingZeros(pageSize);
    }

Domain

Subdomains

Frequently Asked Questions

What does validateAndCalculatePageShifts() do?
validateAndCalculatePageShifts() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java.
Where is validateAndCalculatePageShifts() defined?
validateAndCalculatePageShifts() is defined in buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java at line 344.
What calls validateAndCalculatePageShifts()?
validateAndCalculatePageShifts() is called by 1 function(s): PooledByteBufAllocator.

Analyze Your Own Codebase

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

Try Supermodel Free