File tree 2 files changed +18
-4
lines changed
compiler/rustc_data_structures/src
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,20 @@ impl SipHasher128 {
409
409
}
410
410
}
411
411
412
+ macro_rules! dispatch_value {
413
+ ( $target: expr, $value: expr) => {
414
+ let value = $value;
415
+ #[ allow( unreachable_patterns) ]
416
+ #[ allow( overflowing_literals) ]
417
+ match value {
418
+ 0 ..=0xFF => $target. short_write( value as u8 ) ,
419
+ 0x100 ..=0xFFFF => $target. short_write( value as u16 ) ,
420
+ 0x10000 ..=0xFFFFFFFF => $target. short_write( value as u32 ) ,
421
+ _ => $target. short_write( value as u64 ) ,
422
+ }
423
+ } ;
424
+ }
425
+
412
426
impl Hasher for SipHasher128 {
413
427
#[ inline]
414
428
fn write_u8 ( & mut self , i : u8 ) {
@@ -422,7 +436,7 @@ impl Hasher for SipHasher128 {
422
436
423
437
#[ inline]
424
438
fn write_u32 ( & mut self , i : u32 ) {
425
- self . short_write ( i) ;
439
+ dispatch_value ! ( self , i) ;
426
440
}
427
441
428
442
#[ inline]
@@ -452,7 +466,7 @@ impl Hasher for SipHasher128 {
452
466
453
467
#[ inline]
454
468
fn write_i64 ( & mut self , i : i64 ) {
455
- self . short_write ( i as u64 ) ;
469
+ dispatch_value ! ( self , i as u64 ) ;
456
470
}
457
471
458
472
#[ inline]
Original file line number Diff line number Diff line change 37
37
// Const generic parameter
38
38
// gdb-command:info functions -q function_names::const_generic_fn.*
39
39
// gdb-check:[...]static fn function_names::const_generic_fn_bool<false>();
40
- // gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#fe3cfa0214ac55c7 }>();
40
+ // gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#3fcd7c34c1555be6 }>();
41
41
// gdb-check:[...]static fn function_names::const_generic_fn_signed_int<-7>();
42
42
// gdb-check:[...]static fn function_names::const_generic_fn_unsigned_int<14>();
43
43
76
76
// Const generic parameter
77
77
// cdb-command:x a!function_names::const_generic_fn*
78
78
// cdb-check:[...] a!function_names::const_generic_fn_bool<false> (void)
79
- // cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST$fe3cfa0214ac55c7 > (void)
79
+ // cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST$3fcd7c34c1555be6 > (void)
80
80
// cdb-check:[...] a!function_names::const_generic_fn_unsigned_int<14> (void)
81
81
// cdb-check:[...] a!function_names::const_generic_fn_signed_int<-7> (void)
82
82
You can’t perform that action at this time.
0 commit comments