Answer the question
In order to leave comments, you need to log in
Help explaining the function's logic?
I'm trying to understand the logic of the hash getting code.
int __fastcall mt::String::getHashCode(const char *a1)
{
const char *originalName; // [email protected]
size_t nameLenght; // [email protected]
int originalNamePtr; // [email protected]
unsigned int nameLenghtTMP; // [email protected]
int result; // [email protected]
int v6; // [email protected]
originalName = a1;
nameLenght = strlen(a1);
originalNamePtr = *originalName;
if ( *originalName )
{
nameLenghtTMP = nameLenght;
result = 0;
do
{
result += originalNamePtr * nameLenghtTMP;
v6 = (originalName++)[1];
originalNamePtr = v6;
nameLenghtTMP = (nameLenghtTMP >> 16) + 18000 * (unsigned __int16)nameLenghtTMP;
}
while ( v6 );
}
else
{
result = *originalName;
}
return result;
}
Answer the question
In order to leave comments, you need to log in
about truth and falsity:
1 == true
100500 == true
0 == false
NULL == false
etc.
1) fires when the value in the cell pointed to by originalName is true
2) see about true and false
3) move the pointer to the next cell, take the offset +1, get the second element from the beginning. see address arithmetic
4) byte[2]?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question