Skip to content

Fix SbHash statistics calculation - #752

Draft
Dikluwe wants to merge 4 commits into
coin3d:masterfrom
Dikluwe:fix/sbhash-03-stats
Draft

Dikluwe wants to merge 4 commits into
coin3d:masterfrom
Dikluwe:fix/sbhash-03-stats

Conversation

@Dikluwe

@Dikluwe Dikluwe commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • avoid division by zero when collecting statistics for an empty hash
  • perform floating-point division after conversion instead of truncating integer division
  • test both empty statistics and a fractional average chain length

Stack

Depends on #751. Until the preceding PRs are merged, GitHub shows their commits here as well; the new change is the final statistics commit.

Testing

  • full six-commit stack: ctest --test-dir /tmp/coin-sbhash-pr-build --output-on-failure (8/8 passed)
  • integration lab: 25/25 tests passed

This is PR 3 of 6 in the SbHash cleanup series.

The self-assignment test added in the previous commit is the first
place that instantiates SbHash<unsigned int,int>::operator=() inside
CoinTests.exe. That method calls coin_geq_prime_number(), a private
Coin symbol not exported from the Windows DLL, so the test binary
failed to link with "unresolved external symbol coin_geq_prime_number".

Compile a copy of the (small, self-contained) implementation directly
into the test executable, matching the existing dict.cpp precedent
used elsewhere in this file for the same class of problem.
@Dikluwe
Dikluwe force-pushed the fix/sbhash-03-stats branch from 80a607f to 429bc77 Compare September 18, 2026 21:41

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant