File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1496,7 +1496,7 @@ void c_typecheck_baset::typecheck_c_bit_field_type(c_bit_field_typet &type)
14961496 << " bit field width is negative" ;
14971497 }
14981498
1499- type.set_width (numeric_cast_v<std:: size_t >(i) );
1499+ type.width (i );
15001500 type.remove (ID_size);
15011501 }
15021502
Original file line number Diff line number Diff line change 1212
1313#include " std_types.h"
1414
15+ #include " arith_tools.h"
1516#include " c_types.h"
1617#include " namespace.h"
1718#include " std_expr.h"
@@ -154,6 +155,16 @@ bool is_rvalue_reference(const typet &type)
154155 type.get_bool (ID_C_rvalue_reference);
155156}
156157
158+ std::size_t bitvector_typet::width () const
159+ {
160+ return get_size_t (ID_width);
161+ }
162+
163+ void bitvector_typet::width (const mp_integer &width)
164+ {
165+ set_width (numeric_cast_v<std::size_t >(width));
166+ }
167+
157168void range_typet::set_from (const mp_integer &from)
158169{
159170 set (ID_from, integer2string (from));
Original file line number Diff line number Diff line change @@ -917,16 +917,25 @@ class bitvector_typet : public typet
917917 set_width (width);
918918 }
919919
920+ bitvector_typet (const irep_idt &_id, mp_integer _width) : typet(_id)
921+ {
922+ width (_width);
923+ }
924+
920925 std::size_t get_width () const
921926 {
922927 return get_size_t (ID_width);
923928 }
924929
930+ std::size_t width () const ;
931+
925932 void set_width (std::size_t width)
926933 {
927934 set_size_t (ID_width, width);
928935 }
929936
937+ void width (const mp_integer &);
938+
930939 static void check (
931940 const typet &type,
932941 const validation_modet vm = validation_modet::INVARIANT)
You can’t perform that action at this time.
0 commit comments