Tech News
← Home  ·  All topics

Bitwise Operations

2 GoKawiil briefs on this topic

C++23 introduces bitmask support for enums with automatic operators

A new C++23 proposal, P4313R1, adds a [[=std::bitmask_type]] annotation to enums, enabling automatic bitwise operations for enum classes. This feature simplifies working with enums representing flags by eliminating the need to manually define operators, leveraging a C++26 annotation to opt-in. The discussion also highlights how integral promotions affect bitwise operations on smaller types like shorts, which are promoted to int during computation.

Developer explains the bitap string-matching algorithm's bitwise elegance

A technical blog post walks through how the bitap (shift-and) algorithm finds a pattern inside a text, building it up step by step from the naive brute-force matching approach. The author shows how the method can be adapted to process text as a stream of characters rather than requiring the whole string in memory, and highlights its use of bitwise operations for efficiency when the search pattern is shorter than a machine word.