1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // compile-flags: -C debug-assertions
13 // Test std::num::Wrapping<T> for {uN, iN, usize, isize}
19 use std
::num
::Wrapping
;
21 Add
, Sub
, Mul
, Div
, Rem
, BitXor
, BitOr
, BitAnd
,
22 AddAssign
, SubAssign
, MulAssign
, DivAssign
, RemAssign
, BitXorAssign
, BitOrAssign
, BitAndAssign
,
23 Shl
, Shr
, ShlAssign
, ShrAssign
27 macro_rules
! int_modules
{
28 ($
(($name
:ident
, $size
:expr
),)*) => ($
(
30 pub const BITS
: usize = $size
;
31 pub use std
::$name
::*;
47 #[cfg(target_pointer_width = "32")]
53 #[cfg(target_pointer_width = "64")]
67 macro_rules
! op_test
{
68 ($op
:ident ($lhs
:expr
, $rhs
:expr
) == $ans
:expr
) => {
69 assert_eq
!(black_box(Wrapping($lhs
).$
op(Wrapping($rhs
))), Wrapping($ans
));
70 // FIXME(30524): uncomment this test when it's implemented
71 // assert_eq!(black_box(Wrapping($lhs).$op($rhs)), Wrapping($ans));
75 op_test
!(add(i8::MAX
, 1) == i8::MIN
);
76 op_test
!(add(i16::MAX
, 1) == i16::MIN
);
77 op_test
!(add(i32::MAX
, 1) == i32::MIN
);
78 op_test
!(add(i64::MAX
, 1) == i64::MIN
);
79 op_test
!(add(isize::MAX
, 1) == isize::MIN
);
81 op_test
!(add(u8::MAX
, 1) == 0);
82 op_test
!(add(u16::MAX
, 1) == 0);
83 op_test
!(add(u32::MAX
, 1) == 0);
84 op_test
!(add(u64::MAX
, 1) == 0);
85 op_test
!(add(usize::MAX
, 1) == 0);
88 op_test
!(sub(i8::MIN
, 1) == i8::MAX
);
89 op_test
!(sub(i16::MIN
, 1) == i16::MAX
);
90 op_test
!(sub(i32::MIN
, 1) == i32::MAX
);
91 op_test
!(sub(i64::MIN
, 1) == i64::MAX
);
92 op_test
!(sub(isize::MIN
, 1) == isize::MAX
);
94 op_test
!(sub(0u8, 1) == u8::MAX
);
95 op_test
!(sub(0u16, 1) == u16::MAX
);
96 op_test
!(sub(0u32, 1) == u32::MAX
);
97 op_test
!(sub(0u64, 1) == u64::MAX
);
98 op_test
!(sub(0usize
, 1) == usize::MAX
);
101 op_test
!(mul(i8::MAX
, 2) == -2);
102 op_test
!(mul(i16::MAX
, 2) == -2);
103 op_test
!(mul(i32::MAX
, 2) == -2);
104 op_test
!(mul(i64::MAX
, 2) == -2);
105 op_test
!(mul(isize::MAX
, 2) == -2);
107 op_test
!(mul(u8::MAX
, 2) == u8::MAX
- 1);
108 op_test
!(mul(u16::MAX
, 2) == u16::MAX
- 1);
109 op_test
!(mul(u32::MAX
, 2) == u32::MAX
- 1);
110 op_test
!(mul(u64::MAX
, 2) == u64::MAX
- 1);
111 op_test
!(mul(usize::MAX
, 2) == usize::MAX
- 1);
114 op_test
!(div(i8::MIN
, -1) == i8::MIN
);
115 op_test
!(div(i16::MIN
, -1) == i16::MIN
);
116 op_test
!(div(i32::MIN
, -1) == i32::MIN
);
117 op_test
!(div(i64::MIN
, -1) == i64::MIN
);
118 op_test
!(div(isize::MIN
, -1) == isize::MIN
);
121 op_test
!(rem(i8::MIN
, -1) == 0);
122 op_test
!(rem(i16::MIN
, -1) == 0);
123 op_test
!(rem(i32::MIN
, -1) == 0);
124 op_test
!(rem(i64::MIN
, -1) == 0);
125 op_test
!(rem(isize::MIN
, -1) == 0);
127 // these are not that interesting, just testing to make sure they are implemented correctly
128 op_test
!(bitxor(0b101010i8, 0b100110) == 0b001100);
129 op_test
!(bitxor(0b101010i16, 0b100110) == 0b001100);
130 op_test
!(bitxor(0b101010i32, 0b100110) == 0b001100);
131 op_test
!(bitxor(0b101010i64, 0b100110) == 0b001100);
132 op_test
!(bitxor(0b101010isize
, 0b100110) == 0b001100);
134 op_test
!(bitxor(0b101010u8, 0b100110) == 0b001100);
135 op_test
!(bitxor(0b101010u16, 0b100110) == 0b001100);
136 op_test
!(bitxor(0b101010u32, 0b100110) == 0b001100);
137 op_test
!(bitxor(0b101010u64, 0b100110) == 0b001100);
138 op_test
!(bitxor(0b101010usize
, 0b100110) == 0b001100);
141 op_test
!(bitor(0b101010i8, 0b100110) == 0b101110);
142 op_test
!(bitor(0b101010i16, 0b100110) == 0b101110);
143 op_test
!(bitor(0b101010i32, 0b100110) == 0b101110);
144 op_test
!(bitor(0b101010i64, 0b100110) == 0b101110);
145 op_test
!(bitor(0b101010isize
, 0b100110) == 0b101110);
147 op_test
!(bitor(0b101010u8, 0b100110) == 0b101110);
148 op_test
!(bitor(0b101010u16, 0b100110) == 0b101110);
149 op_test
!(bitor(0b101010u32, 0b100110) == 0b101110);
150 op_test
!(bitor(0b101010u64, 0b100110) == 0b101110);
151 op_test
!(bitor(0b101010usize
, 0b100110) == 0b101110);
154 op_test
!(bitand(0b101010i8, 0b100110) == 0b100010);
155 op_test
!(bitand(0b101010i16, 0b100110) == 0b100010);
156 op_test
!(bitand(0b101010i32, 0b100110) == 0b100010);
157 op_test
!(bitand(0b101010i64, 0b100110) == 0b100010);
158 op_test
!(bitand(0b101010isize
, 0b100110) == 0b100010);
160 op_test
!(bitand(0b101010u8, 0b100110) == 0b100010);
161 op_test
!(bitand(0b101010u16, 0b100110) == 0b100010);
162 op_test
!(bitand(0b101010u32, 0b100110) == 0b100010);
163 op_test
!(bitand(0b101010u64, 0b100110) == 0b100010);
164 op_test
!(bitand(0b101010usize
, 0b100110) == 0b100010);
167 fn test_op_assigns() {
168 macro_rules
! op_assign_test
{
169 ($op
:ident ($initial
:expr
, $rhs
:expr
) == $ans
:expr
) => {
171 let mut tmp
= Wrapping($initial
);
172 tmp
= black_box(tmp
);
173 tmp
.$
op(Wrapping($rhs
));
174 assert_eq
!(black_box(tmp
), Wrapping($ans
));
176 // FIXME(30524): Uncomment this test
179 let mut tmp = Wrapping($initial);
180 tmp = black_box(tmp);
182 assert_eq!(black_box(tmp), Wrapping($ans));
187 op_assign_test
!(add_assign(i8::MAX
, 1) == i8::MIN
);
188 op_assign_test
!(add_assign(i16::MAX
, 1) == i16::MIN
);
189 op_assign_test
!(add_assign(i32::MAX
, 1) == i32::MIN
);
190 op_assign_test
!(add_assign(i64::MAX
, 1) == i64::MIN
);
191 op_assign_test
!(add_assign(isize::MAX
, 1) == isize::MIN
);
193 op_assign_test
!(add_assign(u8::MAX
, 1) == u8::MIN
);
194 op_assign_test
!(add_assign(u16::MAX
, 1) == u16::MIN
);
195 op_assign_test
!(add_assign(u32::MAX
, 1) == u32::MIN
);
196 op_assign_test
!(add_assign(u64::MAX
, 1) == u64::MIN
);
197 op_assign_test
!(add_assign(usize::MAX
, 1) == usize::MIN
);
200 op_assign_test
!(sub_assign(i8::MIN
, 1) == i8::MAX
);
201 op_assign_test
!(sub_assign(i16::MIN
, 1) == i16::MAX
);
202 op_assign_test
!(sub_assign(i32::MIN
, 1) == i32::MAX
);
203 op_assign_test
!(sub_assign(i64::MIN
, 1) == i64::MAX
);
204 op_assign_test
!(sub_assign(isize::MIN
, 1) == isize::MAX
);
206 op_assign_test
!(sub_assign(u8::MIN
, 1) == u8::MAX
);
207 op_assign_test
!(sub_assign(u16::MIN
, 1) == u16::MAX
);
208 op_assign_test
!(sub_assign(u32::MIN
, 1) == u32::MAX
);
209 op_assign_test
!(sub_assign(u64::MIN
, 1) == u64::MAX
);
210 op_assign_test
!(sub_assign(usize::MIN
, 1) == usize::MAX
);
213 op_assign_test
!(mul_assign(i8::MAX
, 2) == -2);
214 op_assign_test
!(mul_assign(i16::MAX
, 2) == -2);
215 op_assign_test
!(mul_assign(i32::MAX
, 2) == -2);
216 op_assign_test
!(mul_assign(i64::MAX
, 2) == -2);
217 op_assign_test
!(mul_assign(isize::MAX
, 2) == -2);
219 op_assign_test
!(mul_assign(u8::MAX
, 2) == u8::MAX
- 1);
220 op_assign_test
!(mul_assign(u16::MAX
, 2) == u16::MAX
- 1);
221 op_assign_test
!(mul_assign(u32::MAX
, 2) == u32::MAX
- 1);
222 op_assign_test
!(mul_assign(u64::MAX
, 2) == u64::MAX
- 1);
223 op_assign_test
!(mul_assign(usize::MAX
, 2) == usize::MAX
- 1);
226 op_assign_test
!(div_assign(i8::MIN
, -1) == i8::MIN
);
227 op_assign_test
!(div_assign(i16::MIN
, -1) == i16::MIN
);
228 op_assign_test
!(div_assign(i32::MIN
, -1) == i32::MIN
);
229 op_assign_test
!(div_assign(i64::MIN
, -1) == i64::MIN
);
230 op_assign_test
!(div_assign(isize::MIN
, -1) == isize::MIN
);
233 op_assign_test
!(rem_assign(i8::MIN
, -1) == 0);
234 op_assign_test
!(rem_assign(i16::MIN
, -1) == 0);
235 op_assign_test
!(rem_assign(i32::MIN
, -1) == 0);
236 op_assign_test
!(rem_assign(i64::MIN
, -1) == 0);
237 op_assign_test
!(rem_assign(isize::MIN
, -1) == 0);
240 // these are not that interesting, just testing to make sure they are implemented correctly
241 op_assign_test
!(bitxor_assign(0b101010i8, 0b100110) == 0b001100);
242 op_assign_test
!(bitxor_assign(0b101010i16, 0b100110) == 0b001100);
243 op_assign_test
!(bitxor_assign(0b101010i32, 0b100110) == 0b001100);
244 op_assign_test
!(bitxor_assign(0b101010i64, 0b100110) == 0b001100);
245 op_assign_test
!(bitxor_assign(0b101010isize
, 0b100110) == 0b001100);
247 op_assign_test
!(bitxor_assign(0b101010u8, 0b100110) == 0b001100);
248 op_assign_test
!(bitxor_assign(0b101010u16, 0b100110) == 0b001100);
249 op_assign_test
!(bitxor_assign(0b101010u32, 0b100110) == 0b001100);
250 op_assign_test
!(bitxor_assign(0b101010u64, 0b100110) == 0b001100);
251 op_assign_test
!(bitxor_assign(0b101010usize
, 0b100110) == 0b001100);
254 op_assign_test
!(bitor_assign(0b101010i8, 0b100110) == 0b101110);
255 op_assign_test
!(bitor_assign(0b101010i16, 0b100110) == 0b101110);
256 op_assign_test
!(bitor_assign(0b101010i32, 0b100110) == 0b101110);
257 op_assign_test
!(bitor_assign(0b101010i64, 0b100110) == 0b101110);
258 op_assign_test
!(bitor_assign(0b101010isize
, 0b100110) == 0b101110);
260 op_assign_test
!(bitor_assign(0b101010u8, 0b100110) == 0b101110);
261 op_assign_test
!(bitor_assign(0b101010u16, 0b100110) == 0b101110);
262 op_assign_test
!(bitor_assign(0b101010u32, 0b100110) == 0b101110);
263 op_assign_test
!(bitor_assign(0b101010u64, 0b100110) == 0b101110);
264 op_assign_test
!(bitor_assign(0b101010usize
, 0b100110) == 0b101110);
267 op_assign_test
!(bitand_assign(0b101010i8, 0b100110) == 0b100010);
268 op_assign_test
!(bitand_assign(0b101010i16, 0b100110) == 0b100010);
269 op_assign_test
!(bitand_assign(0b101010i32, 0b100110) == 0b100010);
270 op_assign_test
!(bitand_assign(0b101010i64, 0b100110) == 0b100010);
271 op_assign_test
!(bitand_assign(0b101010isize
, 0b100110) == 0b100010);
273 op_assign_test
!(bitand_assign(0b101010u8, 0b100110) == 0b100010);
274 op_assign_test
!(bitand_assign(0b101010u16, 0b100110) == 0b100010);
275 op_assign_test
!(bitand_assign(0b101010u32, 0b100110) == 0b100010);
276 op_assign_test
!(bitand_assign(0b101010u64, 0b100110) == 0b100010);
277 op_assign_test
!(bitand_assign(0b101010usize
, 0b100110) == 0b100010);
281 macro_rules
! sh_test
{
282 ($op
:ident ($lhs
:expr
, $rhs
:expr
) == $ans
:expr
) => {
283 assert_eq
!(black_box(Wrapping($lhs
).$
op($rhs
)), Wrapping($ans
));
286 // NOTE: This will break for i8 if we ever get i/u128
287 macro_rules
! sh_test_all
{
289 sh_test
!(shl(i8::MAX
, (i8::BITS
+ 1) as $t
) == -2);
290 sh_test
!(shl(i16::MAX
, (i16::BITS
+ 1) as $t
) == -2);
291 sh_test
!(shl(i32::MAX
, (i32::BITS
+ 1) as $t
) == -2);
292 sh_test
!(shl(i64::MAX
, (i64::BITS
+ 1) as $t
) == -2);
293 sh_test
!(shl(isize::MAX
, (isize::BITS
+ 1) as $t
) == -2);
295 sh_test
!(shl(u8::MAX
, (u8::BITS
+ 1) as $t
) == u8::MAX
- 1);
296 sh_test
!(shl(u16::MAX
, (u16::BITS
+ 1) as $t
) == u16::MAX
- 1);
297 sh_test
!(shl(u32::MAX
, (u32::BITS
+ 1) as $t
) == u32::MAX
- 1);
298 sh_test
!(shl(u64::MAX
, (u64::BITS
+ 1) as $t
) == u64::MAX
- 1);
299 sh_test
!(shl(usize::MAX
, (usize::BITS
+ 1) as $t
) == usize::MAX
- 1);
302 sh_test
!(shr(i8::MAX
, (i8::BITS
+ 1) as $t
) == i8::MAX
/ 2);
303 sh_test
!(shr(i16::MAX
, (i16::BITS
+ 1) as $t
) == i16::MAX
/ 2);
304 sh_test
!(shr(i32::MAX
, (i32::BITS
+ 1) as $t
) == i32::MAX
/ 2);
305 sh_test
!(shr(i64::MAX
, (i64::BITS
+ 1) as $t
) == i64::MAX
/ 2);
306 sh_test
!(shr(isize::MAX
, (isize::BITS
+ 1) as $t
) == isize::MAX
/ 2);
308 sh_test
!(shr(u8::MAX
, (u8::BITS
+ 1) as $t
) == u8::MAX
/ 2);
309 sh_test
!(shr(u16::MAX
, (u16::BITS
+ 1) as $t
) == u16::MAX
/ 2);
310 sh_test
!(shr(u32::MAX
, (u32::BITS
+ 1) as $t
) == u32::MAX
/ 2);
311 sh_test
!(shr(u64::MAX
, (u64::BITS
+ 1) as $t
) == u64::MAX
/ 2);
312 sh_test
!(shr(usize::MAX
, (usize::BITS
+ 1) as $t
) == usize::MAX
/ 2);
315 macro_rules
! sh_test_negative_all
{
317 sh_test
!(shr(i8::MAX
, -((i8::BITS
+ 1) as $t
)) == -2);
318 sh_test
!(shr(i16::MAX
, -((i16::BITS
+ 1) as $t
)) == -2);
319 sh_test
!(shr(i32::MAX
, -((i32::BITS
+ 1) as $t
)) == -2);
320 sh_test
!(shr(i64::MAX
, -((i64::BITS
+ 1) as $t
)) == -2);
321 sh_test
!(shr(isize::MAX
, -((isize::BITS
+ 1) as $t
)) == -2);
323 sh_test
!(shr(u8::MAX
, -((u8::BITS
+ 1) as $t
)) == u8::MAX
- 1);
324 sh_test
!(shr(u16::MAX
, -((u16::BITS
+ 1) as $t
)) == u16::MAX
- 1);
325 sh_test
!(shr(u32::MAX
, -((u32::BITS
+ 1) as $t
)) == u32::MAX
- 1);
326 sh_test
!(shr(u64::MAX
, -((u64::BITS
+ 1) as $t
)) == u64::MAX
- 1);
327 sh_test
!(shr(usize::MAX
, -((usize::BITS
+ 1) as $t
)) == usize::MAX
- 1);
330 sh_test
!(shl(i8::MAX
, -((i8::BITS
+ 1) as $t
)) == i8::MAX
/ 2);
331 sh_test
!(shl(i16::MAX
, -((i16::BITS
+ 1) as $t
)) == i16::MAX
/ 2);
332 sh_test
!(shl(i32::MAX
, -((i32::BITS
+ 1) as $t
)) == i32::MAX
/ 2);
333 sh_test
!(shl(i64::MAX
, -((i64::BITS
+ 1) as $t
)) == i64::MAX
/ 2);
334 sh_test
!(shl(isize::MAX
, -((isize::BITS
+ 1) as $t
)) == isize::MAX
/ 2);
336 sh_test
!(shl(u8::MAX
, -((u8::BITS
+ 1) as $t
)) == u8::MAX
/ 2);
337 sh_test
!(shl(u16::MAX
, -((u16::BITS
+ 1) as $t
)) == u16::MAX
/ 2);
338 sh_test
!(shl(u32::MAX
, -((u32::BITS
+ 1) as $t
)) == u32::MAX
/ 2);
339 sh_test
!(shl(u64::MAX
, -((u64::BITS
+ 1) as $t
)) == u64::MAX
/ 2);
340 sh_test
!(shl(usize::MAX
, -((usize::BITS
+ 1) as $t
)) == usize::MAX
/ 2);
343 // FIXME(#23545): Uncomment the remaining tests
352 //sh_test_all!(isize);
355 //sh_test_negative_all!(i8);
356 //sh_test_negative_all!(i16);
357 //sh_test_negative_all!(i32);
358 //sh_test_negative_all!(i64);
359 //sh_test_negative_all!(isize);
362 fn test_sh_op_assigns() {
363 macro_rules
! sh_assign_test
{
364 ($op
:ident ($initial
:expr
, $rhs
:expr
) == $ans
:expr
) => {{
365 let mut tmp
= Wrapping($initial
);
366 tmp
= black_box(tmp
);
368 assert_eq
!(black_box(tmp
), Wrapping($ans
));
371 macro_rules
! sh_assign_test_all
{
373 sh_assign_test
!(shl_assign(i8::MAX
, (i8::BITS
+ 1) as $t
) == -2);
374 sh_assign_test
!(shl_assign(i16::MAX
, (i16::BITS
+ 1) as $t
) == -2);
375 sh_assign_test
!(shl_assign(i32::MAX
, (i32::BITS
+ 1) as $t
) == -2);
376 sh_assign_test
!(shl_assign(i64::MAX
, (i64::BITS
+ 1) as $t
) == -2);
377 sh_assign_test
!(shl_assign(isize::MAX
, (isize::BITS
+ 1) as $t
) == -2);
379 sh_assign_test
!(shl_assign(u8::MAX
, (u8::BITS
+ 1) as $t
) == u8::MAX
- 1);
380 sh_assign_test
!(shl_assign(u16::MAX
, (u16::BITS
+ 1) as $t
) == u16::MAX
- 1);
381 sh_assign_test
!(shl_assign(u32::MAX
, (u32::BITS
+ 1) as $t
) == u32::MAX
- 1);
382 sh_assign_test
!(shl_assign(u64::MAX
, (u64::BITS
+ 1) as $t
) == u64::MAX
- 1);
383 sh_assign_test
!(shl_assign(usize::MAX
, (usize::BITS
+ 1) as $t
) == usize::MAX
- 1);
386 sh_assign_test
!(shr_assign(i8::MAX
, (i8::BITS
+ 1) as $t
) == i8::MAX
/ 2);
387 sh_assign_test
!(shr_assign(i16::MAX
, (i16::BITS
+ 1) as $t
) == i16::MAX
/ 2);
388 sh_assign_test
!(shr_assign(i32::MAX
, (i32::BITS
+ 1) as $t
) == i32::MAX
/ 2);
389 sh_assign_test
!(shr_assign(i64::MAX
, (i64::BITS
+ 1) as $t
) == i64::MAX
/ 2);
390 sh_assign_test
!(shr_assign(isize::MAX
, (isize::BITS
+ 1) as $t
) == isize::MAX
/ 2);
392 sh_assign_test
!(shr_assign(u8::MAX
, (u8::BITS
+ 1) as $t
) == u8::MAX
/ 2);
393 sh_assign_test
!(shr_assign(u16::MAX
, (u16::BITS
+ 1) as $t
) == u16::MAX
/ 2);
394 sh_assign_test
!(shr_assign(u32::MAX
, (u32::BITS
+ 1) as $t
) == u32::MAX
/ 2);
395 sh_assign_test
!(shr_assign(u64::MAX
, (u64::BITS
+ 1) as $t
) == u64::MAX
/ 2);
396 sh_assign_test
!(shr_assign(usize::MAX
, (usize::BITS
+ 1) as $t
) == usize::MAX
/ 2);
399 macro_rules
! sh_assign_test_negative_all
{
401 sh_assign_test
!(shr_assign(i8::MAX
, -((i8::BITS
+ 1) as $t
)) == -2);
402 sh_assign_test
!(shr_assign(i16::MAX
, -((i16::BITS
+ 1) as $t
)) == -2);
403 sh_assign_test
!(shr_assign(i32::MAX
, -((i32::BITS
+ 1) as $t
)) == -2);
404 sh_assign_test
!(shr_assign(i64::MAX
, -((i64::BITS
+ 1) as $t
)) == -2);
405 sh_assign_test
!(shr_assign(isize::MAX
, -((isize::BITS
+ 1) as $t
)) == -2);
407 sh_assign_test
!(shr_assign(u8::MAX
, -((u8::BITS
+ 1) as $t
)) == u8::MAX
- 1);
408 sh_assign_test
!(shr_assign(u16::MAX
, -((u16::BITS
+ 1) as $t
)) == u16::MAX
- 1);
409 sh_assign_test
!(shr_assign(u32::MAX
, -((u32::BITS
+ 1) as $t
)) == u32::MAX
- 1);
410 sh_assign_test
!(shr_assign(u64::MAX
, -((u64::BITS
+ 1) as $t
)) == u64::MAX
- 1);
411 sh_assign_test
!(shr_assign(usize::MAX
, -((usize::BITS
+ 1) as $t
)) == usize::MAX
- 1);
414 sh_assign_test
!(shl_assign(i8::MAX
, -((i8::BITS
+ 1) as $t
)) == i8::MAX
/ 2);
415 sh_assign_test
!(shl_assign(i16::MAX
, -((i16::BITS
+ 1) as $t
)) == i16::MAX
/ 2);
416 sh_assign_test
!(shl_assign(i32::MAX
, -((i32::BITS
+ 1) as $t
)) == i32::MAX
/ 2);
417 sh_assign_test
!(shl_assign(i64::MAX
, -((i64::BITS
+ 1) as $t
)) == i64::MAX
/ 2);
418 sh_assign_test
!(shl_assign(isize::MAX
, -((isize::BITS
+ 1) as $t
)) == isize::MAX
/ 2);
420 sh_assign_test
!(shl_assign(u8::MAX
, -((u8::BITS
+ 1) as $t
)) == u8::MAX
/ 2);
421 sh_assign_test
!(shl_assign(u16::MAX
, -((u16::BITS
+ 1) as $t
)) == u16::MAX
/ 2);
422 sh_assign_test
!(shl_assign(u32::MAX
, -((u32::BITS
+ 1) as $t
)) == u32::MAX
/ 2);
423 sh_assign_test
!(shl_assign(u64::MAX
, -((u64::BITS
+ 1) as $t
)) == u64::MAX
/ 2);
424 sh_assign_test
!(shl_assign(usize::MAX
, -((usize::BITS
+ 1) as $t
)) == usize::MAX
/ 2);
428 // FIXME(#23545): Uncomment the remaining tests
429 //sh_assign_test_all!(i8);
430 //sh_assign_test_all!(u8);
431 //sh_assign_test_all!(i16);
432 //sh_assign_test_all!(u16);
433 //sh_assign_test_all!(i32);
434 //sh_assign_test_all!(u32);
435 //sh_assign_test_all!(i64);
436 //sh_assign_test_all!(u64);
437 //sh_assign_test_all!(isize);
438 sh_assign_test_all
!(usize);
440 //sh_assign_test_negative_all!(i8);
441 //sh_assign_test_negative_all!(i16);
442 //sh_assign_test_negative_all!(i32);
443 //sh_assign_test_negative_all!(i64);
444 //sh_assign_test_negative_all!(isize);