@@ -39,14 +39,14 @@ bool operator!=(const exprt &lhs, bool rhs)
3939 return !lhs.is_constant () || to_constant_expr (lhs) != rhs;
4040}
4141
42- bool operator ==(const constant_exprt &lhs, bool rhs)
42+ bool constant_exprt:: operator ==(bool rhs) const
4343{
44- return lhs. is_boolean () && (lhs. get_value () != ID_false) == rhs;
44+ return is_boolean () && (get_value () != ID_false) == rhs;
4545}
4646
47- bool operator !=(const constant_exprt &lhs, bool rhs)
47+ bool constant_exprt:: operator !=(bool rhs) const
4848{
49- return !lhs. is_boolean () || (lhs. get_value () != ID_false) != rhs;
49+ return !is_boolean () || (get_value () != ID_false) != rhs;
5050}
5151
5252bool operator ==(const exprt &lhs, int rhs)
@@ -65,94 +65,94 @@ bool operator!=(const exprt &lhs, int rhs)
6565 return true ;
6666}
6767
68- bool operator ==(const constant_exprt &lhs, int rhs)
68+ bool constant_exprt:: operator ==(int rhs) const
6969{
7070 if (rhs == 0 )
7171 {
72- const irep_idt &type_id = lhs. type ().id ();
72+ const irep_idt &type_id = type ().id ();
7373
7474 if (type_id == ID_integer)
7575 {
76- return integer_typet{}.zero_expr () == lhs ;
76+ return integer_typet{}.zero_expr () == * this ;
7777 }
7878 else if (type_id == ID_natural)
7979 {
80- return natural_typet{}.zero_expr () == lhs ;
80+ return natural_typet{}.zero_expr () == * this ;
8181 }
8282 else if (type_id == ID_real)
8383 {
84- return real_typet{}.zero_expr () == lhs ;
84+ return real_typet{}.zero_expr () == * this ;
8585 }
8686 else if (type_id == ID_rational)
8787 {
8888 rationalt rat_value;
89- if (to_rational (lhs , rat_value))
89+ if (to_rational (* this , rat_value))
9090 CHECK_RETURN (false );
9191 return rat_value.is_zero ();
9292 }
9393 else if (
9494 type_id == ID_unsignedbv || type_id == ID_signedbv ||
9595 type_id == ID_c_bool || type_id == ID_c_bit_field)
9696 {
97- return lhs. value_is_zero_string ();
97+ return value_is_zero_string ();
9898 }
9999 else if (type_id == ID_fixedbv)
100100 {
101- return fixedbvt (lhs ).is_zero ();
101+ return fixedbvt (* this ).is_zero ();
102102 }
103103 else if (type_id == ID_floatbv)
104104 {
105- return ieee_float_valuet (lhs ).is_zero ();
105+ return ieee_float_valuet (* this ).is_zero ();
106106 }
107107 else if (type_id == ID_pointer)
108108 {
109- return lhs == nullptr ;
109+ return * this == nullptr ;
110110 }
111111 else
112112 return false ;
113113 }
114114 else if (rhs == 1 )
115115 {
116- const irep_idt &type_id = lhs. type ().id ();
116+ const irep_idt &type_id = type ().id ();
117117
118118 if (type_id == ID_integer)
119119 {
120- return integer_typet{}.one_expr () == lhs ;
120+ return integer_typet{}.one_expr () == * this ;
121121 }
122122 else if (type_id == ID_natural)
123123 {
124- return natural_typet{}.one_expr () == lhs ;
124+ return natural_typet{}.one_expr () == * this ;
125125 }
126126 else if (type_id == ID_real)
127127 {
128- return real_typet{}.one_expr () == lhs ;
128+ return real_typet{}.one_expr () == * this ;
129129 }
130130 else if (type_id == ID_rational)
131131 {
132132 rationalt rat_value;
133- if (to_rational (lhs , rat_value))
133+ if (to_rational (* this , rat_value))
134134 CHECK_RETURN (false );
135135 return rat_value.is_one ();
136136 }
137137 else if (
138138 type_id == ID_unsignedbv || type_id == ID_signedbv ||
139139 type_id == ID_c_bool || type_id == ID_c_bit_field)
140140 {
141- const auto width = to_bitvector_type (lhs. type ()).get_width ();
141+ const auto width = to_bitvector_type (type ()).get_width ();
142142 mp_integer int_value =
143- bvrep2integer (id2string (lhs. get_value ()), width, false );
143+ bvrep2integer (id2string (get_value ()), width, false );
144144 return int_value == 1 ;
145145 }
146146 else if (type_id == ID_fixedbv)
147147 {
148- fixedbv_spect spec{to_fixedbv_type (lhs. type ())};
148+ fixedbv_spect spec{to_fixedbv_type (type ())};
149149 fixedbvt one{spec};
150150 one.from_integer (1 );
151- return one == fixedbvt{lhs };
151+ return one == fixedbvt{* this };
152152 }
153153 else if (type_id == ID_floatbv)
154154 {
155- return ieee_float_valuet (lhs ) == 1 ;
155+ return ieee_float_valuet (* this ) == 1 ;
156156 }
157157 else
158158 return false ;
@@ -161,10 +161,10 @@ bool operator==(const constant_exprt &lhs, int rhs)
161161 PRECONDITION (false );
162162}
163163
164- bool operator !=(const constant_exprt &lhs, int rhs) const
164+ bool constant_exprt:: operator !=(int rhs) const
165165{
166166 PRECONDITION (rhs == 0 || rhs == 1 );
167- return !(lhs == rhs);
167+ return !(* this == rhs);
168168}
169169
170170bool constant_exprt::is_null_pointer () const
@@ -195,16 +195,16 @@ bool operator!=(const exprt &lhs, std::nullptr_t rhs)
195195 return !lhs.is_constant () || !to_constant_expr (lhs).is_null_pointer ();
196196}
197197
198- bool operator ==(const constant_exprt &lhs, std::nullptr_t rhs)
198+ bool constant_exprt:: operator ==(std::nullptr_t rhs) const
199199{
200200 (void )rhs; // unused parameter
201- return lhs. is_null_pointer ();
201+ return is_null_pointer ();
202202}
203203
204- bool operator !=(const constant_exprt &lhs, std::nullptr_t rhs) const
204+ bool constant_exprt:: operator !=(std::nullptr_t rhs) const
205205{
206206 (void )rhs; // unused parameter
207- return !lhs. is_null_pointer ();
207+ return !is_null_pointer ();
208208}
209209
210210void constant_exprt::check (const exprt &expr, const validation_modet vm)
0 commit comments