note 30189 deleted from language.operators.bitwise by sniper

From: Date: Mon, 13 Oct 2003 00:13:19 +0000
Subject: note 30189 deleted from language.operators.bitwise by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58412@lists.php.net to get a copy of this message
Note Submitter: nash@nash.nu ---- A previous comment indicates that << is actually a rotation operation. I believe this is incorrect. Instead the behaviour is the same as C and many other languages. Efectively you can consider all amounts to be modulo the size of the type. ie: 1 << 36 == 1 << (36 mod 32) == 1 << 4 == 16 This is generally an artifact of the architecture, rather then a specifically defined part of the language. Hence such operations should be considered undefined. Note in partiular doing: $x = $x << 32 to clear a int will NOT work, as it is effectively a no-op.

« previous php.notes (#58412) next »