Files
HASUMI Hitoshi 2461caebba [Feature #22118] Introduce Basic Bit Operations into String (#17353)
This patch adds the following methods to String class:

* String#bit_get(offset, lsb_first: true) -> 1 | 0 | nil
* String#bit_set?(offset, lsb_first: true) -> true | false | nil
* String#bit_set(offset, lsb_first: true) -> self
* String#bit_clear(offset, lsb_first: true) -> self
* String#bit_flip(offset, lsb_first: true) -> self
* String#bit_count -> Integer
* String#bitwise_not -> String
* String#bitwise_not! -> self
* String#bitwise_and(other) -> String
* String#bitwise_and!(other) -> self
* String#bitwise_or(other) -> String
* String#bitwise_or!(other) -> self
* String#bitwise_xor(other) -> String
* String#bitwise_xor!(other) -> self

Other than implementation, tests, specs, and docs are added.

Link: [Feature #22118]

## Note

In `string.c`, I wrote some big macro that create method functions and helper
functions:

* STR_DEFINE_BINARY_BITWISE_METHOD
* STR_DEFINE_UNARY_BITWISE_KERNEL
* STR_DEFINE_BINARY_BITWISE_KERNEL

While using macros like this reduces maintainability, I believe it's acceptable
because there are no plans to extend the `bitwise_*` methods beyond this
proposal, and the logic is stable.

On the other hand, other methods such as `bit_get` and `bit_count` are planned to
have argument extensions in the future.
2026-08-06 21:40:37 +09:00
..
2026-01-07 18:01:56 -05:00
2025-05-16 12:47:17 -04:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2025-12-05 19:05:18 -08:00
2025-07-31 09:13:36 -04:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2025-05-01 10:51:22 -04:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2026-02-06 18:35:02 -05:00
2026-01-24 12:38:15 +09:00
2026-06-16 10:09:24 +09:00
2025-10-22 18:04:20 -04:00
2025-10-24 18:09:32 -04:00
2025-12-05 19:04:59 -08:00
2025-11-20 14:06:16 -08:00