Home / Function/ isZero() — netty Function Reference

isZero() — netty Function Reference

Architecture documentation for the isZero() function in PlatformDependent0.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3e03222e_1430_74b9_ac07_6c04303c719b["isZero()"]
  be4c38f2_d236_e498_c295_1033d2617879["PlatformDependent0"]
  3e03222e_1430_74b9_ac07_6c04303c719b -->|defined in| be4c38f2_d236_e498_c295_1033d2617879
  38a30d65_70d7_6436_1c5b_e8e8c0fba12a["getLong()"]
  3e03222e_1430_74b9_ac07_6c04303c719b -->|calls| 38a30d65_70d7_6436_1c5b_e8e8c0fba12a
  e289516f_3edf_77ef_9640_a4fb14c256d3["getInt()"]
  3e03222e_1430_74b9_ac07_6c04303c719b -->|calls| e289516f_3edf_77ef_9640_a4fb14c256d3
  style 3e03222e_1430_74b9_ac07_6c04303c719b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/PlatformDependent0.java lines 996–1020

    static boolean isZero(byte[] bytes, int startPos, int length) {
        if (length <= 0) {
            return true;
        }
        final long baseOffset = BYTE_ARRAY_BASE_OFFSET + startPos;
        int remainingBytes = length & 7;
        final long end = baseOffset + remainingBytes;
        for (long i = baseOffset - 8 + length; i >= end; i -= 8) {
            if (UNSAFE.getLong(bytes, i) != 0) {
                return false;
            }
        }

        if (remainingBytes >= 4) {
            remainingBytes -= 4;
            if (UNSAFE.getInt(bytes, baseOffset + remainingBytes) != 0) {
                return false;
            }
        }
        if (remainingBytes >= 2) {
            return UNSAFE.getChar(bytes, baseOffset) == 0 &&
                    (remainingBytes == 2 || bytes[startPos + 2] == 0);
        }
        return bytes[startPos] == 0;
    }

Domain

Subdomains

Frequently Asked Questions

What does isZero() do?
isZero() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java.
Where is isZero() defined?
isZero() is defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java at line 996.
What does isZero() call?
isZero() calls 2 function(s): getInt, getLong.

Analyze Your Own Codebase

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

Try Supermodel Free