Home / Function/ prefixToSubnetMask() — netty Function Reference

prefixToSubnetMask() — netty Function Reference

Architecture documentation for the prefixToSubnetMask() function in IpSubnetFilterRule.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6ba924f7_e4be_2e1b_ecde_3c4b4a42862d["prefixToSubnetMask()"]
  dff893ee_a16f_1b3d_a2b1_b004425749de["Ip4SubnetFilterRule"]
  6ba924f7_e4be_2e1b_ecde_3c4b4a42862d -->|defined in| dff893ee_a16f_1b3d_a2b1_b004425749de
  c4185464_2099_2a9e_b108_9e389b3838a1["Ip4SubnetFilterRule()"]
  c4185464_2099_2a9e_b108_9e389b3838a1 -->|calls| 6ba924f7_e4be_2e1b_ecde_3c4b4a42862d
  d87ce269_a09c_3dc3_d503_251ebc514d86["Ip6SubnetFilterRule()"]
  d87ce269_a09c_3dc3_d503_251ebc514d86 -->|calls| 6ba924f7_e4be_2e1b_ecde_3c4b4a42862d
  0f2fb401_b634_c64b_f115_66f184c14243["BigInteger()"]
  0f2fb401_b634_c64b_f115_66f184c14243 -->|calls| 6ba924f7_e4be_2e1b_ecde_3c4b4a42862d
  style 6ba924f7_e4be_2e1b_ecde_3c4b4a42862d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java lines 195–207

        private static int prefixToSubnetMask(int cidrPrefix) {
            /*
             * Perform the shift on a long and downcast it to int afterwards.
             * This is necessary to handle a cidrPrefix of zero correctly.
             * The left shift operator on an int only uses the five least
             * significant bits of the right-hand operand. Thus -1 << 32 evaluates
             * to -1 instead of 0. The left shift operator applied on a long
             * uses the six least significant bits.
             *
             * Also see https://github.com/netty/netty/issues/2767
             */
            return (int) (-1L << 32 - cidrPrefix);
        }

Domain

Subdomains

Frequently Asked Questions

What does prefixToSubnetMask() do?
prefixToSubnetMask() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java.
Where is prefixToSubnetMask() defined?
prefixToSubnetMask() is defined in handler/src/main/java/io/netty/handler/ipfilter/IpSubnetFilterRule.java at line 195.
What calls prefixToSubnetMask()?
prefixToSubnetMask() is called by 3 function(s): BigInteger, Ip4SubnetFilterRule, Ip6SubnetFilterRule.

Analyze Your Own Codebase

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

Try Supermodel Free