Skip to content

Commit 4c14f9d

Browse files
committed
Forward Hash::write_iN to Hash::write_uN
1 parent 033013c commit 4c14f9d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libcore/hash/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -333,31 +333,31 @@ pub trait Hasher {
333333
#[inline]
334334
#[stable(feature = "hasher_write", since = "1.3.0")]
335335
fn write_i16(&mut self, i: i16) {
336-
self.write(&i.to_ne_bytes())
336+
self.write_u16(i as u16)
337337
}
338338
/// Writes a single `i32` into this hasher.
339339
#[inline]
340340
#[stable(feature = "hasher_write", since = "1.3.0")]
341341
fn write_i32(&mut self, i: i32) {
342-
self.write(&i.to_ne_bytes())
342+
self.write_u32(i as u32)
343343
}
344344
/// Writes a single `i64` into this hasher.
345345
#[inline]
346346
#[stable(feature = "hasher_write", since = "1.3.0")]
347347
fn write_i64(&mut self, i: i64) {
348-
self.write(&i.to_ne_bytes())
348+
self.write_u64(i as u64)
349349
}
350350
/// Writes a single `i128` into this hasher.
351351
#[inline]
352352
#[stable(feature = "i128", since = "1.26.0")]
353353
fn write_i128(&mut self, i: i128) {
354-
self.write(&i.to_ne_bytes())
354+
self.write_u128(i as u128)
355355
}
356356
/// Writes a single `isize` into this hasher.
357357
#[inline]
358358
#[stable(feature = "hasher_write", since = "1.3.0")]
359359
fn write_isize(&mut self, i: isize) {
360-
self.write(&i.to_ne_bytes())
360+
self.write_usize(i as usize)
361361
}
362362
}
363363

0 commit comments

Comments
 (0)