General

Profile

jhawthorn (John Hawthorn)

  • Login: jhawthorn
  • Registered on: 12/22/2016
  • Last sign in: 07/17/2026

Issues

open closed Total
Assigned issues 25 71 96
Reported issues 6 30 36

Projects

Project Roles Registered on
Ruby Committer 11/25/2021

Activity

07/10/2026

06:56 PM Ruby Feature #20163 (Closed): Introduce #bit_count method on Integer
Applied in changeset commit:git|23c056c83cebad03f716c7af490c8bec9753ec90.
----------
[Feature #20163] Add Integer#bit_count
jhawthorn (John Hawthorn)
06:55 PM Ruby Revision 23c056c8 (git): [Feature #20163] Add Integer#bit_count
jhawthorn (John Hawthorn)
10:02 AM Ruby Revision 6da92441 (git): Fix env debug assertion failure w/ Ractors+JITs
Previously when using a JIT and Ractors at the same time with debug
assertions turned on this could rarely fail with:
vm_core.h:1448: Assertion Failed: VM_ENV_FLAGS:FIXNUM_P(flags)
When using Ractors, any time the VM lock is acquir...
jhawthorn (John Hawthorn)

07/09/2026

09:31 PM Ruby Revision a8a6890b (git): Remove obj_free_object_id
This empty function is no longer needed now that _id2ref is gone. jhawthorn (John Hawthorn)

07/08/2026

09:24 PM Ruby Feature #20163: Introduce #bit_count method on Integer
Couple notes on the various gems
mame (Yusuke Endoh) wrote in #note-31:
> * **Parity bit**: I couldn't find the relevant code in larskanis/pkcs11.
Sorry, the quoted code was from another library. Here it is: https://github.com/l...
jhawthorn (John Hawthorn)
09:05 PM Ruby Feature #20163: Introduce #bit_count method on Integer
mame (Yusuke Endoh) wrote in #note-31:
> but [CIDR] clearly seems like a case where `n.bit_length`, not popcount, is the correct choice.
I do think popcount is the right choice for CIDR. That's what everything other than `IPAddr` is usi...
jhawthorn (John Hawthorn)

07/07/2026

05:04 PM Ruby Feature #20163: Introduce #bit_count method on Integer
I've opened a PR implementing `Integer#bit_count` https://github.com/ruby/ruby/pull/17696
For negative numbers this raises `Math::DomainError`, same as `Integer#digits` when called with a negative number
jhawthorn (John Hawthorn)
02:18 AM Ruby Feature #20163: Introduce #bit_count method on Integer
I tried finding uses in the wild via gem-codesearch. I only looked for `to_s(2).count("1")` which is a pretty inefficient way to `bit_count`, so this would miss any gems which used another technique (a loop or some bit twiddling) to coun... jhawthorn (John Hawthorn)
12:03 AM Ruby Misc #22107: DevMeeting-2026-07-09
* [Feature #20163] Introduce #bit_count method on Integer (jhawthorn)
* matz asked for real-world use cases. I have use case in https://bugs.ruby-lang.org/issues/20163#note-27 (a HAMT) and many uses from existing gems (IP addr CIDR no...
jhawthorn (John Hawthorn)

07/06/2026

11:56 PM Ruby Feature #20163: Introduce #bit_count method on Integer
I have a real-world use case: I've been working on a pure-Ruby [Hash Array Mapped Trie (HAMT)](https://en.wikipedia.org/wiki/Hash_array_mapped_trie) https://github.com/jhawthorn/hamt. I want this because having an immutable hash-table-li... jhawthorn (John Hawthorn)

Also available in: Atom