Home / Function/ hashCodeAscii() — netty Function Reference

hashCodeAscii() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3["hashCodeAscii()"]
  be4c38f2_d236_e498_c295_1033d2617879["PlatformDependent0"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|defined in| be4c38f2_d236_e498_c295_1033d2617879
  06136d57_179c_6e24_6400_51ef4a8739cb["hashCodeAsciiCompute()"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|calls| 06136d57_179c_6e24_6400_51ef4a8739cb
  38a30d65_70d7_6436_1c5b_e8e8c0fba12a["getLong()"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|calls| 38a30d65_70d7_6436_1c5b_e8e8c0fba12a
  c21f3586_1af3_2f0e_a8ed_19f8b64b8ff8["hashCodeAsciiSanitize()"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|calls| c21f3586_1af3_2f0e_a8ed_19f8b64b8ff8
  ea70c928_8d30_7e64_dac0_25553c54a73b["getByte()"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|calls| ea70c928_8d30_7e64_dac0_25553c54a73b
  147022bd_8f7f_ae1c_c3f5_b3663ace6cc9["getShort()"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|calls| 147022bd_8f7f_ae1c_c3f5_b3663ace6cc9
  e289516f_3edf_77ef_9640_a4fb14c256d3["getInt()"]
  f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 -->|calls| e289516f_3edf_77ef_9640_a4fb14c256d3
  style f62d3c1e_24b0_ccd4_679f_80b64ac0bdf3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/PlatformDependent0.java lines 1022–1048

    static int hashCodeAscii(byte[] bytes, int startPos, int length) {
        int hash = HASH_CODE_ASCII_SEED;
        long baseOffset = BYTE_ARRAY_BASE_OFFSET + startPos;
        final int remainingBytes = length & 7;
        final long end = baseOffset + remainingBytes;
        for (long i = baseOffset - 8 + length; i >= end; i -= 8) {
            hash = hashCodeAsciiCompute(UNSAFE.getLong(bytes, i), hash);
        }
        if (remainingBytes == 0) {
            return hash;
        }
        int hcConst = HASH_CODE_C1;
        if (remainingBytes != 2 & remainingBytes != 4 & remainingBytes != 6) { // 1, 3, 5, 7
            hash = hash * HASH_CODE_C1 + hashCodeAsciiSanitize(UNSAFE.getByte(bytes, baseOffset));
            hcConst = HASH_CODE_C2;
            baseOffset++;
        }
        if (remainingBytes != 1 & remainingBytes != 4 & remainingBytes != 5) { // 2, 3, 6, 7
            hash = hash * hcConst + hashCodeAsciiSanitize(UNSAFE.getShort(bytes, baseOffset));
            hcConst = hcConst == HASH_CODE_C1 ? HASH_CODE_C2 : HASH_CODE_C1;
            baseOffset += 2;
        }
        if (remainingBytes >= 4) { // 4, 5, 6, 7
            return hash * hcConst + hashCodeAsciiSanitize(UNSAFE.getInt(bytes, baseOffset));
        }
        return hash;
    }

Domain

Subdomains

Frequently Asked Questions

What does hashCodeAscii() do?
hashCodeAscii() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java.
Where is hashCodeAscii() defined?
hashCodeAscii() is defined in common/src/main/java/io/netty/util/internal/PlatformDependent0.java at line 1022.
What does hashCodeAscii() call?
hashCodeAscii() calls 6 function(s): getByte, getInt, getLong, getShort, hashCodeAsciiCompute, hashCodeAsciiSanitize.

Analyze Your Own Codebase

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

Try Supermodel Free