Skip to content

Commit 2fa76cd

Browse files
committed
Rollup merge of #48133 - matthiaskrgr:endianess_to_endianness, r=oli-obk typo: correct endianess to endianness (this also changes function names!)
2 parents 2c1accb + 161e8ff commit 2fa76cd

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/librustc_mir/interpret/memory.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> {
238238
self.tcx.data_layout.pointer_size.bytes()
239239
}
240240

241-
pub fn endianess(&self) -> layout::Endian {
241+
pub fn endianness(&self) -> layout::Endian {
242242
self.tcx.data_layout.endian
243243
}
244244

@@ -722,7 +722,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> {
722722

723723
pub fn read_primval(&self, ptr: MemoryPointer, ptr_align: Align, size: u64, signed: bool) -> EvalResult<'tcx, PrimVal> {
724724
self.check_relocation_edges(ptr, size)?; // Make sure we don't read part of a pointer as a pointer
725-
let endianess = self.endianess();
725+
let endianness = self.endianness();
726726
let bytes = self.get_bytes_unchecked(ptr, size, ptr_align.min(self.int_align(size)))?;
727727
// Undef check happens *after* we established that the alignment is correct.
728728
// We must not return Ok() for unaligned pointers!
@@ -731,9 +731,9 @@ impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> {
731731
}
732732
// Now we do the actual reading
733733
let bytes = if signed {
734-
read_target_int(endianess, bytes).unwrap() as u128
734+
read_target_int(endianness, bytes).unwrap() as u128
735735
} else {
736-
read_target_uint(endianess, bytes).unwrap()
736+
read_target_uint(endianness, bytes).unwrap()
737737
};
738738
// See if we got a pointer
739739
if size != self.pointer_size() {
@@ -756,7 +756,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> {
756756
}
757757

758758
pub fn write_primval(&mut self, ptr: MemoryPointer, ptr_align: Align, val: PrimVal, size: u64, signed: bool) -> EvalResult<'tcx> {
759-
let endianess = self.endianess();
759+
let endianness = self.endianness();
760760

761761
let bytes = match val {
762762
PrimVal::Ptr(val) => {
@@ -788,9 +788,9 @@ impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> {
788788
let align = self.int_align(size);
789789
let dst = self.get_bytes_mut(ptr, size, ptr_align.min(align))?;
790790
if signed {
791-
write_target_int(endianess, dst, bytes as i128).unwrap();
791+
write_target_int(endianness, dst, bytes as i128).unwrap();
792792
} else {
793-
write_target_uint(endianess, dst, bytes).unwrap();
793+
write_target_uint(endianness, dst, bytes).unwrap();
794794
}
795795
}
796796

@@ -941,41 +941,41 @@ impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> {
941941
}
942942

943943
////////////////////////////////////////////////////////////////////////////////
944-
// Methods to access integers in the target endianess
944+
// Methods to access integers in the target endianness
945945
////////////////////////////////////////////////////////////////////////////////
946946

947947
fn write_target_uint(
948-
endianess: layout::Endian,
948+
endianness: layout::Endian,
949949
mut target: &mut [u8],
950950
data: u128,
951951
) -> Result<(), io::Error> {
952952
let len = target.len();
953-
match endianess {
953+
match endianness {
954954
layout::Endian::Little => target.write_uint128::<LittleEndian>(data, len),
955955
layout::Endian::Big => target.write_uint128::<BigEndian>(data, len),
956956
}
957957
}
958958
fn write_target_int(
959-
endianess: layout::Endian,
959+
endianness: layout::Endian,
960960
mut target: &mut [u8],
961961
data: i128,
962962
) -> Result<(), io::Error> {
963963
let len = target.len();
964-
match endianess {
964+
match endianness {
965965
layout::Endian::Little => target.write_int128::<LittleEndian>(data, len),
966966
layout::Endian::Big => target.write_int128::<BigEndian>(data, len),
967967
}
968968
}
969969

970-
fn read_target_uint(endianess: layout::Endian, mut source: &[u8]) -> Result<u128, io::Error> {
971-
match endianess {
970+
fn read_target_uint(endianness: layout::Endian, mut source: &[u8]) -> Result<u128, io::Error> {
971+
match endianness {
972972
layout::Endian::Little => source.read_uint128::<LittleEndian>(source.len()),
973973
layout::Endian::Big => source.read_uint128::<BigEndian>(source.len()),
974974
}
975975
}
976976

977-
fn read_target_int(endianess: layout::Endian, mut source: &[u8]) -> Result<i128, io::Error> {
978-
match endianess {
977+
fn read_target_int(endianness: layout::Endian, mut source: &[u8]) -> Result<i128, io::Error> {
978+
match endianness {
979979
layout::Endian::Little => source.read_int128::<LittleEndian>(source.len()),
980980
layout::Endian::Big => source.read_int128::<BigEndian>(source.len()),
981981
}

src/libstd/f32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ impl f32 {
10231023
/// This is currently identical to `transmute::<u32, f32>(v)` on all platforms.
10241024
/// It turns out this is incredibly portable, for two reasons:
10251025
///
1026-
/// * Floats and Ints have the same endianess on all supported platforms.
1026+
/// * Floats and Ints have the same endianness on all supported platforms.
10271027
/// * IEEE-754 very precisely specifies the bit layout of floats.
10281028
///
10291029
/// However there is one caveat: prior to the 2008 version of IEEE-754, how

src/libstd/f64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ impl f64 {
978978
/// This is currently identical to `transmute::<u64, f64>(v)` on all platforms.
979979
/// It turns out this is incredibly portable, for two reasons:
980980
///
981-
/// * Floats and Ints have the same endianess on all supported platforms.
981+
/// * Floats and Ints have the same endianness on all supported platforms.
982982
/// * IEEE-754 very precisely specifies the bit layout of floats.
983983
///
984984
/// However there is one caveat: prior to the 2008 version of IEEE-754, how

0 commit comments

Comments
 (0)