Home / Function/ equals() — netty Function Reference

equals() — netty Function Reference

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

Function java CommonUtil Internal calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  2cae8627_cae5_091a_fce1_110ca16bdb9c["equals()"]
  be4c38f2_d236_e498_c295_1033d2617879["PlatformDependent0"]
  2cae8627_cae5_091a_fce1_110ca16bdb9c -->|defined in| be4c38f2_d236_e498_c295_1033d2617879
  d58337bd_8745_3d47_ca3a_e9b417558f4e["Throwable()"]
  d58337bd_8745_3d47_ca3a_e9b417558f4e -->|calls| 2cae8627_cae5_091a_fce1_110ca16bdb9c
  3ff615de_7832_58ad_d48c_9ac0f11e5783["isAndroid0()"]
  3ff615de_7832_58ad_d48c_9ac0f11e5783 -->|calls| 2cae8627_cae5_091a_fce1_110ca16bdb9c
  38a30d65_70d7_6436_1c5b_e8e8c0fba12a["getLong()"]
  2cae8627_cae5_091a_fce1_110ca16bdb9c -->|calls| 38a30d65_70d7_6436_1c5b_e8e8c0fba12a
  e289516f_3edf_77ef_9640_a4fb14c256d3["getInt()"]
  2cae8627_cae5_091a_fce1_110ca16bdb9c -->|calls| e289516f_3edf_77ef_9640_a4fb14c256d3
  ea70c928_8d30_7e64_dac0_25553c54a73b["getByte()"]
  2cae8627_cae5_091a_fce1_110ca16bdb9c -->|calls| ea70c928_8d30_7e64_dac0_25553c54a73b
  style 2cae8627_cae5_091a_fce1_110ca16bdb9c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/PlatformDependent0.java lines 942–969

    static boolean equals(byte[] bytes1, int startPos1, byte[] bytes2, int startPos2, int length) {
        int remainingBytes = length & 7;
        final long baseOffset1 = BYTE_ARRAY_BASE_OFFSET + startPos1;
        final long diff = startPos2 - startPos1;
        if (length >= 8) {
            final long end = baseOffset1 + remainingBytes;
            for (long i = baseOffset1 - 8 + length; i >= end; i -= 8) {
                if (UNSAFE.getLong(bytes1, i) != UNSAFE.getLong(bytes2, i + diff)) {
                    return false;
                }
            }
        }
        if (remainingBytes >= 4) {
            remainingBytes -= 4;
            long pos = baseOffset1 + remainingBytes;
            if (UNSAFE.getInt(bytes1, pos) != UNSAFE.getInt(bytes2, pos + diff)) {
                return false;
            }
        }
        final long baseOffset2 = baseOffset1 + diff;
        if (remainingBytes >= 2) {
            return UNSAFE.getChar(bytes1, baseOffset1) == UNSAFE.getChar(bytes2, baseOffset2) &&
                    (remainingBytes == 2 ||
                    UNSAFE.getByte(bytes1, baseOffset1 + 2) == UNSAFE.getByte(bytes2, baseOffset2 + 2));
        }
        return remainingBytes == 0 ||
                UNSAFE.getByte(bytes1, baseOffset1) == UNSAFE.getByte(bytes2, baseOffset2);
    }

Domain

Subdomains

Frequently Asked Questions

What does equals() do?
equals() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java.
Where is equals() defined?
equals() is defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java at line 942.
What does equals() call?
equals() calls 3 function(s): getByte, getInt, getLong.
What calls equals()?
equals() is called by 2 function(s): Throwable, isAndroid0.

Analyze Your Own Codebase

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

Try Supermodel Free