Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integral types #58

Open
kc9jud opened this issue Oct 14, 2024 · 3 comments
Open

Integral types #58

kc9jud opened this issue Oct 14, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@kc9jud
Copy link

kc9jud commented Oct 14, 2024

Is there a reason why Discrete.h uses std::is_same rather than std::is_integral here?

static_assert(std::is_same<_Scalar, int32_t>::value, "uniformInt needs integral types.");

If this is instead std::is_integral<_Scalar>::value, then the discrete generators can also be used for int64_t, uint32_t, etc.

@kc9jud
Copy link
Author

kc9jud commented Oct 14, 2024

Would this line:

if (bitcnt + bitsize < 32)

need to change to if (bitcnt + bitsize < CHAR_BIT*sizeof(_Scalar))?

@kc9jud
Copy link
Author

kc9jud commented Oct 14, 2024

As I look further, it seems like there are a decent number of places where other types/constants need to become sizeof-dependent. Is this of interest?

@bab2min bab2min added the enhancement New feature or request label Oct 20, 2024
@bab2min
Copy link
Owner

bab2min commented Oct 20, 2024

Hi @kc9jud , thank you for your interest in this repository.
It is because Discrete generators use some specialized routine for int32_t SIMD.
At the time of first implementation, only int32_t was considered, so additional implementations were required to make it work for other integral types.
I will add support for other integral types in future updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants