Skip to content

Commit 9290ca4

Browse files
authored
Fix enum warnings and make SerOption tests uniform (#1302)
1 parent 625556d commit 9290ca4

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/sst/core/serialization/impl/serialize_array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct serialize_impl_fixed_array
8585
{
8686
void operator()(OBJ_TYPE& ary, serializer& ser, ser_opt_t opt)
8787
{
88-
ser_opt_t elem_opt = opt & SerOption::as_ptr_elem ? SerOption::as_ptr : SerOption::none;
88+
ser_opt_t elem_opt = SerOption::is_set(opt, SerOption::as_ptr_elem) ? SerOption::as_ptr : SerOption::none;
8989
const auto& aPtr = get_ptr(ary); // reference to ary if it's a pointer; &ary otherwise
9090
switch ( ser.mode() ) {
9191
case serializer::MAP:
@@ -148,7 +148,7 @@ class serialize_impl<pvt::array_wrapper<ELEM_T, SIZE_T>>
148148
{
149149
void operator()(pvt::array_wrapper<ELEM_T, SIZE_T>& ary, serializer& ser, ser_opt_t opt)
150150
{
151-
ser_opt_t elem_opt = opt & SerOption::as_ptr_elem ? SerOption::as_ptr : SerOption::none;
151+
ser_opt_t elem_opt = SerOption::is_set(opt, SerOption::as_ptr_elem) ? SerOption::as_ptr : SerOption::none;
152152
switch ( const auto mode = ser.mode() ) {
153153
case serializer::MAP:
154154
if constexpr ( !std::is_void_v<ELEM_T> ) {

src/sst/core/serialization/impl/serialize_insertable.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ class serialize_impl<
157157
SST_SER(e);
158158
}
159159
else {
160-
ser_opt_t opts = 0;
161-
if ( SerOption::is_set(options, SerOption::as_ptr_elem) ) opts = SerOption::as_ptr;
160+
ser_opt_t opts =
161+
SerOption::is_set(options, SerOption::as_ptr_elem) ? SerOption::as_ptr : SerOption::none;
162162
// Iterate over references to elements, casting away any const in keys
163163
for ( auto& e : obj )
164164
SST_SER((value_type&) e, opts);
@@ -172,8 +172,7 @@ class serialize_impl<
172172
size_t size;
173173
ser.unpack(size);
174174

175-
ser_opt_t opts = 0;
176-
if ( SerOption::is_set(options, SerOption::as_ptr_elem) ) opts = SerOption::as_ptr;
175+
ser_opt_t opts = SerOption::is_set(options, SerOption::as_ptr_elem) ? SerOption::as_ptr : SerOption::none;
177176

178177
// Erase the container
179178
obj.clear();

src/sst/core/serialization/impl/serialize_tuple.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class serialize_impl<T<Ts...>, std::enable_if_t<is_same_template_v<T, std::tuple
3232
void operator()(T<Ts...>& t, serializer& ser, ser_opt_t options)
3333
{
3434
// Serialize each element of tuple or pair
35-
ser_opt_t opt = (options & SerOption::as_ptr_elem) ? SerOption::as_ptr : 0;
35+
ser_opt_t opt = SerOption::is_set(options, SerOption::as_ptr_elem) ? SerOption::as_ptr : SerOption::none;
3636
std::apply([&](auto&... e) { ((sst_ser_object(ser, e, opt)), ...); }, t);
3737
}
3838

0 commit comments

Comments
 (0)