Skip to content

Fix warning about possible integer truncation - #54

Merged
alt-graph merged 1 commit into
mainfrom
cleanup/integer_size
Aug 31, 2026
Merged

Fix warning about possible integer truncation#54
alt-graph merged 1 commit into
mainfrom
cleanup/integer_size

Conversation

@alt-graph

Copy link
Copy Markdown
Member

[why]

gcc warns about data loss in an implicit integer conversion:

SmallVector.cc:1318:31: warning: conversion from ‘std::vector<unsigned int>::size_type’
{aka ‘long unsigned int’} to ‘unsigned int’ may change value [-Wconversion]
 1318 |             (vec.size() == 0) ? 0 : (dist(gen) % vec.size());

[how]

Use an explicit static_cast to get to the correct integer size.

@alt-graph alt-graph self-assigned this Aug 31, 2026
@alt-graph

Copy link
Copy Markdown
Member Author

We also need to update our Visual Studio build helper:

"Can not find 'C:\Program Files\Microsoft Visual Studio\2022', '2019', or '2017'"
Can not find Visual Studio installation at default location

Will address that in a separate PR.

@alt-graph
alt-graph marked this pull request as ready for review August 31, 2026 12:30
[why]
gcc warns about data loss in an implicit integer conversion:
SmallVector.cc:1318:31: warning: conversion from ‘std::vector<unsigned int>::size_type’
{aka ‘long unsigned int’} to ‘unsigned int’ may change value [-Wconversion]
 1318 |             (vec.size() == 0) ? 0 : (dist(gen) % vec.size());

[how]
Use an explicit static_cast to get to the correct integer size.
@alt-graph
alt-graph force-pushed the cleanup/integer_size branch from 0e5d518 to a84a77b Compare August 31, 2026 13:56
@alt-graph

Copy link
Copy Markdown
Member Author

Thanks again, @Finii!

@alt-graph
alt-graph merged commit 964221a into main Aug 31, 2026
7 checks passed
@alt-graph
alt-graph deleted the cleanup/integer_size branch August 31, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants