commit
35f47b9d40
1 changed files with 1 additions and 1 deletions
|
@ -312,7 +312,7 @@ if (str.indexOf("Widget") != -1) {
|
||||||
|
|
||||||
#### The bitwise NOT trick
|
#### The bitwise NOT trick
|
||||||
|
|
||||||
One of the old tricks used here is the [bitwise NOT](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT) `~` operator. It converts the number to a 32-bit integer (removes the decimal part if exists) and then reverses all bits in its binary representation.
|
One of the old tricks used here is the [bitwise NOT](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_NOT) `~` operator. It converts the number to a 32-bit integer (removes the decimal part if exists) and then reverses all bits in its binary representation.
|
||||||
|
|
||||||
In practice, that means a simple thing: for 32-bit integers `~n` equals `-(n+1)`.
|
In practice, that means a simple thing: for 32-bit integers `~n` equals `-(n+1)`.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue