[PR #232] [MERGED] Bit counting functions (CountBits, CountBits64) #253

Closed
opened 2026-05-05 03:44:01 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ultimatepp/ultimatepp/pull/232
Author: @ismail-yilmaz
Created: 2/8/2025
Status: Merged
Merged: 2/14/2025
Merged by: @mirek-fidler

Base: masterHead: count_bits


📝 Commits (3)

  • 85f5186 Core: CountBits and CountBits64 functions are added.
  • fe1ba6a autotest: CountBits test added.
  • 85d6270 Core: inline force on CountBits and CountBits64

📊 Changes

5 files changed (+112 additions, -0 deletions)

View changed files

autotest/CountBits/CountBits.cpp (+33 -0)
autotest/CountBits/CountBits.upp (+10 -0)
autotest/CountBits/Etalon.log (+21 -0)
📝 uppsrc/Core/Ops.h (+41 -0)
📝 uppsrc/Core/src.tpp/Mem_en-us.tpp (+7 -0)

📄 Description

This PR adds CountBits() and CountBits64() functions to Upp/Core and provides API docs & a simple autotest.

These functions are useful for counting set bits in a bitmask.

Default implementation uses platform specific popcount variants for popular compilers (GCC/CLANG/MSVC). Otherwise it uses a well-known custom implementation for fallback, which can be easily vectorized by the compiler as well.

Please check.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ultimatepp/ultimatepp/pull/232 **Author:** [@ismail-yilmaz](https://github.com/ismail-yilmaz) **Created:** 2/8/2025 **Status:** ✅ Merged **Merged:** 2/14/2025 **Merged by:** [@mirek-fidler](https://github.com/mirek-fidler) **Base:** `master` ← **Head:** `count_bits` --- ### 📝 Commits (3) - [`85f5186`](https://github.com/ultimatepp/ultimatepp/commit/85f518606620cd9c876787874cd51ab806c9b44a) Core: CountBits and CountBits64 functions are added. - [`fe1ba6a`](https://github.com/ultimatepp/ultimatepp/commit/fe1ba6a77085fb8435c7a9ea3ad795bbb2e71a89) autotest: CountBits test added. - [`85d6270`](https://github.com/ultimatepp/ultimatepp/commit/85d6270239f9b6cd1368042862039baafbff145d) Core: inline force on CountBits and CountBits64 ### 📊 Changes **5 files changed** (+112 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `autotest/CountBits/CountBits.cpp` (+33 -0) ➕ `autotest/CountBits/CountBits.upp` (+10 -0) ➕ `autotest/CountBits/Etalon.log` (+21 -0) 📝 `uppsrc/Core/Ops.h` (+41 -0) 📝 `uppsrc/Core/src.tpp/Mem_en-us.tpp` (+7 -0) </details> ### 📄 Description This PR adds `CountBits()` and `CountBits64()` functions to `Upp/Core` and provides API docs & a simple autotest. These functions are useful for counting set bits in a bitmask. Default implementation uses platform specific popcount variants for popular compilers (GCC/CLANG/MSVC). Otherwise it uses a well-known custom implementation for fallback, which can be easily vectorized by the compiler as well. Please check. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 03:44:01 -06:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#253
No description provided.