Skip to content

Commit 0fa5635

Browse files
Timo AlhoJkarVN
authored andcommitted
Fix warnings on GCC -wall
1 parent 3384a18 commit 0fa5635

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

include/pcg_extras.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ struct static_arbitrary_seed {
618618
public:
619619
static constexpr IntType value = fnv(IntType(2166136261U ^ sizeof(IntType)),
620620
__DATE__ __TIME__ __FILE__);
621+
622+
//Prevent creation, while keeping GCC from giving a warning
623+
static_arbitrary_seed() = delete;
621624
};
622625

623626
// Sometimes, when debugging or testing, it's handy to be able print the name

include/pcg_uint128.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,20 @@ namespace pcg_extras {
105105

106106
inline bitcount_t flog2(uint32_t v)
107107
{
108-
return 31 - __builtin_clz(v);
108+
return bitcount_t(31 - __builtin_clz(v));
109109
}
110110

111111
inline bitcount_t trailingzeros(uint32_t v)
112112
{
113-
return __builtin_ctz(v);
113+
return bitcount_t(__builtin_ctz(v));
114114
}
115115

116116
inline bitcount_t flog2(uint64_t v)
117117
{
118118
#if UINT64_MAX == ULONG_MAX
119-
return 63 - __builtin_clzl(v);
119+
return bitcount_t(63 - __builtin_clzl(v));
120120
#elif UINT64_MAX == ULLONG_MAX
121-
return 63 - __builtin_clzll(v);
121+
return bitcount_t(63 - __builtin_clzll(v));
122122
#else
123123
#error Cannot find a function for uint64_t
124124
#endif
@@ -127,9 +127,9 @@ inline bitcount_t flog2(uint64_t v)
127127
inline bitcount_t trailingzeros(uint64_t v)
128128
{
129129
#if UINT64_MAX == ULONG_MAX
130-
return __builtin_ctzl(v);
130+
return bitcount_t(__builtin_ctzl(v));
131131
#elif UINT64_MAX == ULLONG_MAX
132-
return __builtin_ctzll(v);
132+
return bitcount_t(__builtin_ctzll(v));
133133
#else
134134
#error Cannot find a function for uint64_t
135135
#endif

0 commit comments

Comments
 (0)