Home / Function/ hashCodeAsciiSafe() — netty Function Reference

hashCodeAsciiSafe() — netty Function Reference

Architecture documentation for the hashCodeAsciiSafe() function in PlatformDependent.java from the netty codebase.

Function java CommonUtil Internal calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  91a08e9d_6796_2685_69c3_75e596cc8ed2["hashCodeAsciiSafe()"]
  2e66d079_807f_6785_864f_73ab09fbc515["PlatformDependent"]
  91a08e9d_6796_2685_69c3_75e596cc8ed2 -->|defined in| 2e66d079_807f_6785_864f_73ab09fbc515
  3af1bd26_c77c_d99a_9035_8e53792f0908["hashCodeAscii()"]
  3af1bd26_c77c_d99a_9035_8e53792f0908 -->|calls| 91a08e9d_6796_2685_69c3_75e596cc8ed2
  8a8c01b2_2927_ec9a_df31_d52673d17a1e["hashCodeAsciiCompute()"]
  91a08e9d_6796_2685_69c3_75e596cc8ed2 -->|calls| 8a8c01b2_2927_ec9a_df31_d52673d17a1e
  5140069a_ce25_e10a_f6aa_156c805ce627["getLongSafe()"]
  91a08e9d_6796_2685_69c3_75e596cc8ed2 -->|calls| 5140069a_ce25_e10a_f6aa_156c805ce627
  ae4d7f15_c0c8_f109_f40b_d0bcfaa79f1f["getShortSafe()"]
  91a08e9d_6796_2685_69c3_75e596cc8ed2 -->|calls| ae4d7f15_c0c8_f109_f40b_d0bcfaa79f1f
  0c5f477e_e016_b32c_c819_980f9dacb99c["getIntSafe()"]
  91a08e9d_6796_2685_69c3_75e596cc8ed2 -->|calls| 0c5f477e_e016_b32c_c819_980f9dacb99c
  style 91a08e9d_6796_2685_69c3_75e596cc8ed2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/PlatformDependent.java lines 1694–1724

    static int hashCodeAsciiSafe(byte[] bytes, int startPos, int length) {
        int hash = HASH_CODE_ASCII_SEED;
        final int remainingBytes = length & 7;
        final int end = startPos + remainingBytes;
        for (int i = startPos - 8 + length; i >= end; i -= 8) {
            hash = PlatformDependent0.hashCodeAsciiCompute(getLongSafe(bytes, i), hash);
        }
        switch(remainingBytes) {
        case 7:
            return ((hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos]))
                          * HASH_CODE_C2 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos + 1)))
                          * HASH_CODE_C1 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 3));
        case 6:
            return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos)))
                         * HASH_CODE_C2 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 2));
        case 5:
            return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos]))
                         * HASH_CODE_C2 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 1));
        case 4:
            return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos));
        case 3:
            return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos]))
                         * HASH_CODE_C2 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos + 1));
        case 2:
            return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos));
        case 1:
            return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos]);
        default:
            return hash;
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does hashCodeAsciiSafe() do?
hashCodeAsciiSafe() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/PlatformDependent.java.
Where is hashCodeAsciiSafe() defined?
hashCodeAsciiSafe() is defined in common/src/main/java/io/netty/util/internal/PlatformDependent.java at line 1694.
What does hashCodeAsciiSafe() call?
hashCodeAsciiSafe() calls 4 function(s): getIntSafe, getLongSafe, getShortSafe, hashCodeAsciiCompute.
What calls hashCodeAsciiSafe()?
hashCodeAsciiSafe() is called by 1 function(s): hashCodeAscii.

Analyze Your Own Codebase

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

Try Supermodel Free