Skip to content

Allow for optimizing out bound check on 64 bit systems#1909

Merged
natoscott merged 1 commit intohtop-dev:mainfrom
BenBE:next-prime-frenzy
Feb 19, 2026
Merged

Allow for optimizing out bound check on 64 bit systems#1909
natoscott merged 1 commit intohtop-dev:mainfrom
BenBE:next-prime-frenzy

Conversation

@BenBE
Copy link
Member

@BenBE BenBE commented Feb 19, 2026

This re-wording of the previous snippet hints to the compiler more directly, that this condition can be dropped if the type of size_t is narrower than the one used for OEISprimes (uint64_t).

This optimization applies for 32 bit systems.

NB: This saves some precious CPU cycles on 64 bit systems … ;-)

@BenBE BenBE added this to the 3.5.0 milestone Feb 19, 2026
@BenBE BenBE added enhancement Extension or improvement to existing feature code quality ♻️ Code quality enhancement labels Feb 19, 2026
This shortens the list of available primes to what is available on
different system architectures based on the maximum amount of memory
addressable for the program using pointers.
@BenBE BenBE force-pushed the next-prime-frenzy branch from 35e2adb to 4acef15 Compare February 19, 2026 22:47
@natoscott natoscott merged commit c17f6ac into htop-dev:main Feb 19, 2026
20 checks passed
@Explorer09
Copy link
Contributor

I've updated my PR #1842 to reflect the changes done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality ♻️ Code quality enhancement enhancement Extension or improvement to existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments