Skip to content

Commit 8bab767

Browse files
committed
[type casting & coercion] add note about bitshift and large integers. fixes airbnb#109
1 parent fa32d9a commit 8bab767

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@
956956
```
957957
958958
- If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](http://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you're doing.
959+
- **Note** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer [source](http://es5.github.io/#x11.7). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109)
959960

960961
```javascript
961962
// good

0 commit comments

Comments
 (0)