Skip to content

Fix warnings on GCC -wall #60

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/pcg_extras.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ struct static_arbitrary_seed {
public:
static constexpr IntType value = fnv(IntType(2166136261U ^ sizeof(IntType)),
__DATE__ __TIME__ __FILE__);

//Prevent creation, while keeping GCC from giving a warning
static_arbitrary_seed() = delete;
};

// Sometimes, when debugging or testing, it's handy to be able print the name
Expand Down
12 changes: 6 additions & 6 deletions include/pcg_uint128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ namespace pcg_extras {

inline bitcount_t flog2(uint32_t v)
{
return 31 - __builtin_clz(v);
return bitcount_t(31 - __builtin_clz(v));
}

inline bitcount_t trailingzeros(uint32_t v)
{
return __builtin_ctz(v);
return bitcount_t(__builtin_ctz(v));
}

inline bitcount_t flog2(uint64_t v)
{
#if UINT64_MAX == ULONG_MAX
return 63 - __builtin_clzl(v);
return bitcount_t(63 - __builtin_clzl(v));
#elif UINT64_MAX == ULLONG_MAX
return 63 - __builtin_clzll(v);
return bitcount_t(63 - __builtin_clzll(v));
#else
#error Cannot find a function for uint64_t
#endif
Expand All @@ -123,9 +123,9 @@ inline bitcount_t flog2(uint64_t v)
inline bitcount_t trailingzeros(uint64_t v)
{
#if UINT64_MAX == ULONG_MAX
return __builtin_ctzl(v);
return bitcount_t(__builtin_ctzl(v));
#elif UINT64_MAX == ULLONG_MAX
return __builtin_ctzll(v);
return bitcount_t(__builtin_ctzll(v));
#else
#error Cannot find a function for uint64_t
#endif
Expand Down