FRAMEWORK/Hash.hpp
//---------------------------------------------------------------------------
//Yoshimitsu is beyond hope - he fights as a true underdog - nothing to lose everything to gain, sharing with those in need - a true copylefter.
Yoshimitsu is beyond hope - he fights as a true underdog - nothing to lose everything to gain, sharing with those in need - a true copylefter.
Yoshimitsu is beyond hope - he fights as a true underdog - nothing to lose everything to gain sharing with those in need - a true copylefter .
uint32_t FNV1A_Hash_Yoshimitsu(const char *str, uint32_t wrdlen)
{
    const uint32_t PRIME = 709607;
    uint32_t hash32 = 2166136261;
    uint32_t hash32B = 2166136261;
    uint32_t hash32C = 2166136261;
    uint32_t hash32D = 2166136261;
    const char *p = str;
    for(; wrdlen >= 4*2*sizeof(uint32_t); wrdlen -= 4*2*sizeof(uint32_t), p += 4*2*sizeof(uint32_t)) {
		hash32 = (hash32 ^ (_rotl(*(uint32_t *)(p+0),5) ^ *(uint32_t *)(p+4))) * PRIME;        
		hash32B = (hash32B ^ (_rotl(*(uint32_t *)(p+8),5) ^ *(uint32_t *)(p+12))) * PRIME;        
		hash32C = (hash32C ^ (_rotl(*(uint32_t *)(p+16),5) ^ *(uint32_t *)(p+20))) * PRIME;        
		hash32D = (hash32D ^ (_rotl(*(uint32_t *)(p+24),5) ^ *(uint32_t *)(p+28))) * PRIME;        
    }
	if (p != str) {
		hash32 = (hash32 ^ _rotl(hash32C,5) ) * PRIME;
		hash32B = (hash32B ^ _rotl(hash32D,5) ) * PRIME;
	}
    if (wrdlen & 4*sizeof(uint32_t)) {	
		hash32 = (hash32 ^ (_rotl(*(uint32_t *)(p+0),5) ^ *(uint32_t *)(p+4))) * PRIME;        
		hash32B = (hash32B ^ (_rotl(*(uint32_t *)(p+8),5) ^ *(uint32_t *)(p+12))) * PRIME;        
		p += 8*sizeof(uint16_t);
    }
    if (wrdlen & 2*sizeof(uint32_t)) {
		hash32 = (hash32 ^ *(uint32_t*)(p+0)) * PRIME;
		hash32B = (hash32B ^ *(uint32_t*)(p+4)) * PRIME;
		p += 4*sizeof(uint16_t);
    }
    if (wrdlen & sizeof(uint32_t)) {
		hash32 = (hash32 ^ *(uint16_t*)(p+0)) * PRIME;
		hash32B = (hash32B ^ *(uint16_t*)(p+2)) * PRIME;
		p += 2*sizeof(uint16_t);
    }
    if (wrdlen & sizeof(uint16_t)) {
        hash32 = (hash32 ^ *(uint16_t*)p) * PRIME;
        p += sizeof(uint16_t);
    }
    if (wrdlen & 1) 
        hash32 = (hash32 ^ *p) * PRIME;
    hash32 = (hash32 ^ _rotl(hash32B,5) ) * PRIME;
    return hash32 ^ (hash32 >> 16);
}
uint32_t FNV1A_Hash_Yoshimitsu ( const char * str , uint32_t wrdlen ) { const uint32_t PRIME = 709607 ; uint32_t hash32 = 2166136261 ; uint32_t hash32B = 2166136261 ; uint32_t hash32C = 2166136261 ; uint32_t hash32D = 2166136261 ; const char * p = str ; for ( ; wrdlen >= 4 * 2 * sizeof ( uint32_t ) ; wrdlen -= 4 * 2 * sizeof ( uint32_t ) , p += 4 * 2 * sizeof ( uint32_t ) ) { hash32 = ( hash32 ^ ( _rotl ( * ( uint32_t * ) ( p + 0 ) , 5 ) ^ * ( uint32_t * ) ( p + 4 ) ) ) * PRIME ; hash32B = ( hash32B ^ ( _rotl ( * ( uint32_t * ) ( p + 8 ) , 5 ) ^ * ( uint32_t * ) ( p + 12 ) ) ) * PRIME ; hash32C = ( hash32C ^ ( _rotl ( * ( uint32_t * ) ( p + 16 ) , 5 ) ^ * ( uint32_t * ) ( p + 20 ) ) ) * PRIME ; hash32D = ( hash32D ^ ( _rotl ( * ( uint32_t * ) ( p + 24 ) , 5 ) ^ * ( uint32_t * ) ( p + 28 ) ) ) * PRIME ; } if ( p != str ) { hash32 = ( hash32 ^ _rotl ( hash32C , 5 ) ) * PRIME ; hash32B = ( hash32B ^ _rotl ( hash32D , 5 ) ) * PRIME ; } if ( wrdlen & 4 * sizeof ( uint32_t ) ) { hash32 = ( hash32 ^ ( _rotl ( * ( uint32_t * ) ( p + 0 ) , 5 ) ^ * ( uint32_t * ) ( p + 4 ) ) ) * PRIME ; hash32B = ( hash32B ^ ( _rotl ( * ( uint32_t * ) ( p + 8 ) , 5 ) ^ * ( uint32_t * ) ( p + 12 ) ) ) * PRIME ; p += 8 * sizeof ( uint16_t ) ; } if ( wrdlen & 2 * sizeof ( uint32_t ) ) { hash32 = ( hash32 ^ * ( uint32_t * ) ( p + 0 ) ) * PRIME ; hash32B = ( hash32B ^ * ( uint32_t * ) ( p + 4 ) ) * PRIME ; p += 4 * sizeof ( uint16_t ) ; } if ( wrdlen & sizeof ( uint32_t ) ) { hash32 = ( hash32 ^ * ( uint16_t * ) ( p + 0 ) ) * PRIME ; hash32B = ( hash32B ^ * ( uint16_t * ) ( p + 2 ) ) * PRIME ; p += 2 * sizeof ( uint16_t ) ; } if ( wrdlen & sizeof ( uint16_t ) ) { hash32 = ( hash32 ^ * ( uint16_t * ) p ) * PRIME ; p += sizeof ( uint16_t ) ; } if ( wrdlen & 1 ) hash32 = ( hash32 ^ * p ) * PRIME ; hash32 = ( hash32 ^ _rotl ( hash32B , 5 ) ) * PRIME ; return hash32 ^ ( hash32 >> 16 ) ; }
Yoshimitsu is beyond hope - he fights as a true underdog - nothing to lose everything to gain, sharing with those in need - a true copylefter.
Yoshimitsu is beyond hope - he fights as a true underdog - nothing to lose everything to gain sharing with those in need - a true copylefter .
//hash32 = (hash32 ^ (_rotl_KAZE(*(DWORD *)(p+0),5) ^ *(DWORD *)(p+4))) * PRIME;         //hash32B = (hash32B ^ (_rotl_KAZE(*(DWORD *)(p+8),5) ^ *(DWORD *)(p+12))) * PRIME;         //        hash32 = _rotl_KAZE( (hash32 ^ (_rotl_KAZE(*(DWORD *)(p+0),5) ^ *(DWORD *)(p+4))) , 19); // 1<<19 = 524288 ~ 709607; * -> <<'s //        hash32B = _rotl_KAZE( (hash32B ^ (_rotl_KAZE(*(DWORD *)(p+8),5) ^ *(DWORD *)(p+12))) , 19);  //3*2*sizeof(DWORD) //hash32 = ( (hash32 ^ (_rotl(*(DWORD *)(p+0),5) ^ *(DWORD *)(p+4))) * PRIME ) ^ ( *(DWORD *)(p+8) * PRIME ); //hash32B = ( (hash32B ^ (_rotl(*(DWORD *)(p+12),5) ^ *(DWORD *)(p+16))) * PRIME ) ^ ( *(DWORD *)(p+20) * PRIME ); //4*2*sizeof(DWORD) // 1111=15; 10111=23 // Cases: 0,1,2,3,4,5,6,7,...,15 // Cases: 0,1,2,3,4,5,6,7