大家帮帮忙~hash << 5 + hash 中的<<是什么意思?该如何处理

WBOY
Libérer: 2016-06-13 10:17:17
original
1059 Les gens l'ont consulté

大家帮帮忙~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   hash = ((hash   hash = ((hash   hash = ((hash   hash = ((hash   hash = ((hash   hash = ((hash   hash = ((hash   }
  switch (nKeyLength) {
  case 7: hash = ((hash   case 6: hash = ((hash   case 5: hash = ((hash   case 4: hash = ((hash   case 3: hash = ((hash   case 2: hash = ((hash   case 1: hash = ((hash   case 0: break;
EMPTY_SWITCH_DEFAULT_CASE()
  }
  return hash;
}

------解决方案--------------------
是位移

php移位运算 lz 参考:http://apps.hi.baidu.com/share/detail/23928402
------解决方案--------------------

PHP code
$a & $b    And(按位与)    将把 $a 和 $b 中都为 1 的位设为 1。$a | $b    Or(按位或)    将把 $a 或者 $b 中为 1 的位设为 1。$a ^ $b    Xor(按位异或)    将把 $a 和 $b 中不同的位设为 1。~ $a    Not(按位非)    将 $a 中为 0 的位设为 1,反之亦然。$a > $b    Shift right(右移)    将 $a 中的位向右移动 $b 次(每一次移动都表示“除以 2”)。<br><font color="#e78608">------解决方案--------------------</font><br>长见识了……<br><font color="#e78608">------解决方案--------------------</font><br>是的,但是位移只能做乘除法<br>
Copier après la connexion
探讨

额 非常感谢了 但是还有一个问题~ 恩~以 位 来做相应的运算 有什么好处? 与运算速度有关吗?
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!