godotengine / godotengine/godot-docs
Misleading documentation for int.operator>>
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Issue description:**
-1/2 does not equal to -1 >> 1
Documentation for operator>> says: "Effectively the same as dividing by a power of 2".
This is only true when the integer is non-negative.
When shifted right, the new bits will have the value of the (previously) most significant bit.
Example:
0xF000_0000_0000_0000 >> 12 is 0xFFFF_0000_0000_0000
0x0F00_0000_0000_0000 >> 12 is 0x0000_F000_0000_0000
Negative numbers will converge to -1, and other numbers will converge to 0.
**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_int.html#class-int-operator-bwsr-int
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.