Skip to content

Commit c4f8887

Browse files
committed
Replace uses of deprecated integer2ulong
Use suitable numeric_cast<...>.
1 parent 36c13ef commit c4f8887

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/ansi-c/expr2c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ std::string expr2ct::convert_constant(
18311831
else if(int_value>=' ' && int_value<126)
18321832
{
18331833
dest+='\'';
1834-
dest+=static_cast<char>(integer2ulong(int_value));
1834+
dest+=numeric_cast_v<char>(int_value);
18351835
dest+='\'';
18361836
}
18371837
else

src/goto-programs/interpreter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ exprt interpretert::get_value(
512512
return std::move(result);
513513
}
514514
if(use_non_det &&
515-
memory[integer2ulong(offset)].initialized!=
515+
memory[numeric_cast_v<std::size_t>(offset)].initialized!=
516516
memory_cellt::initializedt::WRITTEN_BEFORE_READ)
517517
return side_effect_expr_nondett(type, source_locationt());
518518
mp_vectort rhs;
519-
rhs.push_back(memory[integer2ulong(offset)].value);
519+
rhs.push_back(memory[numeric_cast_v<std::size_t>(offset)].value);
520520
return get_value(type, rhs);
521521
}
522522

@@ -647,7 +647,7 @@ exprt interpretert::get_value(
647647
}
648648

649649
// Retrieve value of basic data type
650-
return from_integer(rhs[integer2ulong(offset)], type);
650+
return from_integer(rhs[numeric_cast_v<std::size_t>(offset)], type);
651651
}
652652

653653
/// executes the assign statement at the current pc value
@@ -690,7 +690,7 @@ void interpretert::execute_assign()
690690

691691
for(mp_integer i=0; i<size; ++i)
692692
{
693-
memory[integer2ulong(address+i)].initialized=
693+
memory[numeric_cast_v<std::size_t>(address+i)].initialized=
694694
memory_cellt::initializedt::READ_BEFORE_WRITTEN;
695695
}
696696
}
@@ -707,7 +707,7 @@ void interpretert::assign(
707707
if((address+i)<memory.size())
708708
{
709709
mp_integer address_val=address+i;
710-
memory_cellt &cell=memory[integer2ulong(address_val)];
710+
memory_cellt &cell=memory[numeric_cast_v<std::size_t>(address_val)];
711711
if(show)
712712
{
713713
status() << total_steps << " ** assigning "
@@ -884,7 +884,7 @@ void interpretert::build_memory_map(const symbolt &symbol)
884884
if(size!=0)
885885
{
886886
mp_integer address=memory.size();
887-
memory.resize(integer2ulong(address+size));
887+
memory.resize(numeric_cast_v<std::size_t>(address+size));
888888
memory_map[symbol.name]=address;
889889
inverse_memory_map[address]=symbol.name;
890890
}
@@ -942,7 +942,7 @@ mp_integer interpretert::build_memory_map(
942942
size=1; // This is a hack to create existence
943943

944944
mp_integer address=memory.size();
945-
memory.resize(integer2ulong(address+size));
945+
memory.resize(numeric_cast_v<std::size_t>(address+size));
946946
memory_map[id]=address;
947947
inverse_memory_map[address]=id;
948948
dynamic_types.insert(std::pair<const irep_idt, typet>(id, alloc_type));

src/goto-programs/interpreter_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class interpretert:public messaget
145145

146146
mp_integer base_address_to_actual_size(const mp_integer &address) const
147147
{
148-
auto memory_iter=memory.find(integer2ulong(address));
148+
auto memory_iter=memory.find(numeric_cast_v<std::size_t>(address));
149149
if(memory_iter==memory.end())
150150
return 0;
151151
mp_integer ret=0;

src/goto-programs/interpreter_evaluate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void interpretert::read(
3333

3434
if((address+i)<memory.size())
3535
{
36-
const memory_cellt &cell=memory[integer2ulong(address+i)];
36+
const memory_cellt &cell=memory[numeric_cast_v<std::size_t>(address+i)];
3737
value=cell.value;
3838
if(cell.initialized==memory_cellt::initializedt::UNKNOWN)
3939
cell.initialized=memory_cellt::initializedt::READ_BEFORE_WRITTEN;
@@ -84,7 +84,7 @@ void interpretert::allocate(
8484
{
8585
if((address+i)<memory.size())
8686
{
87-
memory_cellt &cell=memory[integer2ulong(address+i)];
87+
memory_cellt &cell=memory[numeric_cast_v<std::size_t>(address+i)];
8888
cell.value=0;
8989
cell.initialized=memory_cellt::initializedt::UNKNOWN;
9090
}

0 commit comments

Comments
 (0)