You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
FYI: the link is now broken. Is this function limited to ints or will it work on numbers of type bignum?Daniel Henry– Daniel Henry2019年03月25日 02:52:30 +00:00Commented Mar 25, 2019 at 2:52
-
1Since the link is broken, the same procedure can be found here with a bit more information: stackoverflow.com/a/30002555/9439097charelf– charelf2020年05月02日 18:03:44 +00:00Commented May 2, 2020 at 18:03
-
This works, but is limited to 32-bit integers. Extending it to different-sized integers is possible (following the pattern) but not trivial for non-powers-of-two.nneonneo– nneonneo2024年08月15日 01:10:03 +00:00Commented Aug 15, 2024 at 1:10
-
graphics.stanford.edu/~seander/bithacks.htmlIshrak M– Ishrak M2025年01月19日 15:42:23 +00:00Commented Jan 19, 2025 at 15:42
lang-py