Skip to content

Commit ce6a297

Browse files
committed
Use auto to avoid unnecessary signed/unsigned conversion
1 parent 5e5e264 commit ce6a297

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

jbmc/src/java_bytecode/java_bytecode_parser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ void java_bytecode_parsert::rfields(classt &parsed_class)
890890
field.is_public=(access_flags&ACC_PUBLIC)!=0;
891891
field.is_protected=(access_flags&ACC_PROTECTED)!=0;
892892
field.is_private=(access_flags&ACC_PRIVATE)!=0;
893-
size_t flags=(field.is_public?1:0)+
893+
const auto flags = (field.is_public ? 1 : 0) +
894894
(field.is_protected?1:0)+
895895
(field.is_private?1:0);
896896
DATA_INVARIANT(flags<=1, "at most one of public, protected, private");
@@ -1686,7 +1686,7 @@ void java_bytecode_parsert::rmethod(classt &parsed_class)
16861686
method.base_name=pool_entry(name_index).s;
16871687
method.descriptor=id2string(pool_entry(descriptor_index).s);
16881688

1689-
size_t flags=(method.is_public?1:0)+
1689+
const auto flags = (method.is_public ? 1 : 0) +
16901690
(method.is_protected?1:0)+
16911691
(method.is_private?1:0);
16921692
DATA_INVARIANT(flags<=1, "at most one of public, protected, private");

src/goto-cc/gcc_mode.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ int gcc_modet::doit()
529529
gcc_version.is_at_least(7))
530530
config.ansi_c.ts_18661_3_Floatn_types=true;
531531

532-
int gcc_float128_minor_version = config.ansi_c.arch == "x86_64" ? 3 : 5;
532+
const auto gcc_float128_minor_version =
533+
config.ansi_c.arch == "x86_64" ? 3u : 5u;
533534

534535
config.ansi_c.Float128_type =
535536
gcc_version.flavor == gcc_versiont::flavort::GCC &&

src/goto-programs/elf_reader.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ elf_readert::elf_readert(std::istream &_in):in(_in)
3333

3434
if(elf_class==ELF32)
3535
{
36-
char ei_data=elf32_header.e_ident[5];
36+
const auto ei_data = elf32_header.e_ident[5];
3737

3838
if(ei_data==1)
3939
little_endian=true;
@@ -80,7 +80,7 @@ elf_readert::elf_readert(std::istream &_in):in(_in)
8080
reinterpret_cast<char*>(&elf64_header),
8181
sizeof(elf64_header));
8282

83-
char ei_data=elf64_header.e_ident[5];
83+
const auto ei_data = elf64_header.e_ident[5];
8484

8585
if(ei_data==1)
8686
little_endian=true;

src/solvers/flattening/bv_utils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ literalt bv_utilst::carry(literalt a, literalt b, literalt c)
234234
if(prop.has_set_to() && prop.cnf_handled_well())
235235
{
236236
// propagation possible?
237-
unsigned const_count=
237+
const auto const_count =
238238
a.is_constant() + b.is_constant() + c.is_constant();
239239

240240
// propagation is possible if two or three inputs are constant

0 commit comments

Comments
 (0)