CBMC
endianness_map_wide.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, dkr@amazon.com
6 
7 \*******************************************************************/
8 
9 #include "endianness_map_wide.h"
10 
11 #include <util/arith_tools.h>
13 #include <util/type.h>
14 
16 {
17  if(src.id() == ID_pointer)
18  {
19  auto s = pointer_offset_bits(src, ns);
20  CHECK_RETURN(s.has_value());
21  s.value() = s.value() * 2;
22 
23  const std::size_t new_size = map.size() + numeric_cast_v<std::size_t>(*s);
24  map.reserve(new_size);
25 
26  for(std::size_t i = map.size(); i < new_size; ++i)
27  map.push_back(i);
28  }
29  else
31 }
void build_little_endian(const typet &) override
const namespacet & ns
virtual void build_little_endian(const typet &type)
std::vector< size_t > map
const irep_idt & id() const
Definition: irep.h:384
The type of an expression, extends irept.
Definition: type.h:29
std::optional< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
Pointer Logic.
#define CHECK_RETURN(CONDITION)
Definition: invariant.h:495
Defines typet, type_with_subtypet and type_with_subtypest.