Help me ~ What does hash <5 + hash <mean? What should I do?

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.