Help me ~ What does & lt; in hash & lt; 5 + hash mean? [Code = PHP] [/code] staticinlineulongzend_inline_hash_func (char * arKey, uintnKeyLength) {& nbsp; regis help ~ Hash <5 + hash < <是什么意思?
[Code = PHP] [/code] static inline ulong zend_inline_hash_func (char * arKey, uint nKeyLength)
{
Register ulong hash = 5381;
/* Variant with the hash unrolled eight times */
For (; nKeyLength> = 8; nKeyLength-= 8 {
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
Hash = (hash <5) + hash) + * arKey ++;
}
Switch (nKeyLength ){
Case 7: hash = (hash <5) + hash) + * arKey ++;/* fallthrough ...*/
Case 6: hash = (hash <5) + hash) + * arKey ++;/* fallthrough ...*/
Case 5: hash = (hash <5) + hash) + * arKey ++;/* fallthrough ...*/
Case 4: hash = (hash <5) + hash) + * arKey ++;/* fallthrough ...*/
Case 3: hash = (hash <5) + hash) + * arKey ++;/* fallthrough ...*/
Case 2: hash = (hash <5) + hash) + * arKey ++;/* fallthrough ...*/
Case 1: hash = (hash <5) + hash) + * arKey ++; break;
Case 0: break;
EMPTY_SWITCH_DEFAULT_CASE ()
}
Return hash;
}
------ Solution --------------------
Yes shift
Php shift operation lz reference: http://apps.hi.baidu.com/share/detail/23928402
------ Solution --------------------
PHP code
$ A & $ B And (bitwise And) sets the bits of $ a And $ B to 1. $ A | $ B Or (bitwise Or) sets the bit where $ a Or $ B is 1 to 1. $ A ^ $ B Xor (bitwise Xor) sets the bitwise of $ a and $ B to 1 .~ $ A Not (Not by bit) sets the bit 0 in $ a to 1, and vice versa. $ A <$ B Shift left (left Shift) moves the bits in $ a to the left $ B (each movement represents "multiplied by 2 "). $ A> $ B Shift right (right Shift): move the bits in $ a to the right $ B (each movement means "divided by 2 ").
------ Solution --------------------
Long knowledge ......
------ Solution --------------------
Yes, but the displacement can only be multiplication and division.
Discussion
Thank you very much, but there is another problem ~ En ~ What are the advantages of bitwise operations? Is it related to the computing speed?