Skip to content

Commit

Permalink
Rollup merge of rust-lang#122762 - RoboSchmied:RoboSchmied-typo, r=wo…
Browse files Browse the repository at this point in the history
…rkingjubilee

fix typo of endianness

fix typo
endianess -> endianness
  • Loading branch information
workingjubilee authored Mar 24, 2024
2 parents d19dc15 + 0d5a3f4 commit c037685
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compiler/stable_mir/src/mir/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl IndexedVal for AllocId {
/// Utility function used to read an allocation data into a unassigned integer.
pub(crate) fn read_target_uint(mut bytes: &[u8]) -> Result<u128, Error> {
let mut buf = [0u8; std::mem::size_of::<u128>()];
match MachineInfo::target_endianess() {
match MachineInfo::target_endianness() {
Endian::Little => {
bytes.read_exact(&mut buf[..bytes.len()])?;
Ok(u128::from_le_bytes(buf))
Expand All @@ -70,7 +70,7 @@ pub(crate) fn read_target_uint(mut bytes: &[u8]) -> Result<u128, Error> {
/// Utility function used to read an allocation data into an assigned integer.
pub(crate) fn read_target_int(mut bytes: &[u8]) -> Result<i128, Error> {
let mut buf = [0u8; std::mem::size_of::<i128>()];
match MachineInfo::target_endianess() {
match MachineInfo::target_endianness() {
Endian::Little => {
bytes.read_exact(&mut buf[..bytes.len()])?;
Ok(i128::from_le_bytes(buf))
Expand Down
2 changes: 1 addition & 1 deletion compiler/stable_mir/src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl MachineInfo {
with(|cx| cx.target_info())
}

pub fn target_endianess() -> Endian {
pub fn target_endianness() -> Endian {
with(|cx| cx.target_info().endian)
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ extern "rust-intrinsic" {
/// No matter whether the output is an array or an unsigned integer, it is treated as a single
/// contiguous list of bits. The bitmask is always packed on the least-significant side of the
/// output, and padded with 0s in the most-significant bits. The order of the bits depends on
/// endianess:
/// endianness:
///
/// * On little endian, the least significant bit corresponds to the first vector element.
/// * On big endian, the least significant bit corresponds to the last vector element.
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/src/shims/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
let bitmask_len = u32::try_from(bitmask_len).unwrap();

// To read the mask, we transmute it to an integer.
// That does the right thing wrt endianess.
// That does the right thing wrt endianness.
let mask_ty = this.machine.layouts.uint(mask.layout.size).unwrap();
let mask = mask.transmute(mask_ty, this)?;
let mask: u64 = this.read_scalar(&mask)?.to_bits(mask_ty.size)?.try_into().unwrap();
Expand Down Expand Up @@ -509,7 +509,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
}
}
// We have to change the type of the place to be able to write `res` into it. This
// transmutes the integer to an array, which does the right thing wrt endianess.
// transmutes the integer to an array, which does the right thing wrt endianness.
let dest =
dest.transmute(this.machine.layouts.uint(dest.layout.size).unwrap(), this)?;
this.write_int(res, &dest)?;
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/src/shims/unix/linux/fd/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl FileDescriptor for Event {
}

/// A write call adds the 8-byte integer value supplied in
/// its buffer (in native endianess) to the counter. The maximum value that may be
/// its buffer (in native endianness) to the counter. The maximum value that may be
/// stored in the counter is the largest unsigned 64-bit value
/// minus 1 (i.e., 0xfffffffffffffffe). If the addition would
/// cause the counter's value to exceed the maximum, then the
Expand All @@ -57,7 +57,7 @@ impl FileDescriptor for Event {
) -> InterpResult<'tcx, io::Result<usize>> {
let v1 = self.val.get();
let bytes: [u8; 8] = bytes.try_into().unwrap(); // FIXME fail gracefully when this has the wrong size
// Convert from target endianess to host endianess.
// Convert from target endianness to host endianness.
let num = match tcx.sess.target.endian {
Endian::Little => u64::from_le_bytes(bytes),
Endian::Big => u64::from_be_bytes(bytes),
Expand Down

0 comments on commit c037685

Please sign in to comment.