Skip to content

Commit

Permalink
Run cargo fmt --all
Browse files Browse the repository at this point in the history
  • Loading branch information
clin1234 committed Jan 23, 2025
1 parent 1f0d756 commit abf9a6e
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions pyo3-ffi/src/cpython/unicodeobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::Py_hash_t;
use crate::{PyObject, Py_UCS1, Py_UCS2, Py_UCS4, Py_ssize_t};
use libc::wchar_t;
use std::os::raw::{c_char, c_int, c_uint, c_void, c_ushort};
use std::os::raw::{c_char, c_int, c_uint, c_ushort, c_void};

// skipped Py_UNICODE_ISSPACE()
// skipped Py_UNICODE_ISLOWER()
Expand Down Expand Up @@ -143,7 +143,7 @@ const STATE_ASCII_WIDTH: u8 = 1;
#[cfg(all(not(GraalPy), Py_3_14))]
const STATE_STATICALLY_ALLOCATED_INDEX: usize =
(STATE_INTERNED_WIDTH + STATE_KIND_WIDTH + STATE_COMPACT_WIDTH + STATE_ASCII_WIDTH) as usize;
#[cfg(all(not(GraalPy), Py_3_14))]
#[cfg(all(not(GraalPy), Py_3_14))]
const STATE_STATICALLY_ALLOCATED_WIDTH: u8 = 1;

#[cfg(not(any(Py_3_12, GraalPy)))]
Expand Down Expand Up @@ -285,27 +285,39 @@ impl PyASCIIObjectState {
#[cfg(not(Py_3_14))]
#[inline]
unsafe fn statically_allocated(&self) -> c_uint {
std::mem::transmute(self.bitfield.get(STATE_STATICALLY_ALLOCATED_INDEX, STATE_STATICALLY_ALLOCATED_WIDTH) as u32)
std::mem::transmute(self.bitfield.get(
STATE_STATICALLY_ALLOCATED_INDEX,
STATE_STATICALLY_ALLOCATED_WIDTH,
) as u32)
}

#[cfg(not(Py_3_14))]
#[inline]
unsafe fn set_statically_allocated(&mut self, val: c_uint) {
let val: u32 = std::mem::transmute(val);
self.bitfield
.set(STATE_STATICALLY_ALLOCATED_INDEX, STATE_STATICALLY_ALLOCATED_WIDTH, val as u64)
self.bitfield.set(
STATE_STATICALLY_ALLOCATED_INDEX,
STATE_STATICALLY_ALLOCATED_WIDTH,
val as u64,
)
}

#[inline]
unsafe fn statically_allocated(&self) -> c_ushort {
std::mem::transmute(self.bitfield.get(STATE_STATICALLY_ALLOCATED_INDEX, STATE_STATICALLY_ALLOCATED_WIDTH) as c_ushort)
std::mem::transmute(self.bitfield.get(
STATE_STATICALLY_ALLOCATED_INDEX,
STATE_STATICALLY_ALLOCATED_WIDTH,
) as c_ushort)
}

#[inline]
unsafe fn set_statically_allocated(&mut self, val: c_ushort) {
let val: c_ushort = std::mem::transmute(val);
self.bitfield
.set(STATE_STATICALLY_ALLOCATED_INDEX, STATE_STATICALLY_ALLOCATED_WIDTH, val as u64)
self.bitfield.set(
STATE_STATICALLY_ALLOCATED_INDEX,
STATE_STATICALLY_ALLOCATED_WIDTH,
val as u64,
)
}

#[cfg(not(Py_3_12))]
Expand Down Expand Up @@ -358,15 +370,15 @@ pub struct PyASCIIObject {
/// unsigned int ascii:1;
/// unsigned int ready:1;
/// unsigned int :24;
///
///
/// 3.12 and 3.13:
/// unsigned int interned:2; // SSTATE_* constants.
/// unsigned int kind:3; // PyUnicode_*_KIND constants.
/// unsigned int compact:1;
/// unsigned int ascii:1;
/// unsigned int statically_allocated:1;
/// unsigned int :24;
///
///
/// 3.14 and later:
/// uint16_t interned; // SSTATE_* constants.
/// unsigned short kind:3; // PyUnicode_*_KIND constants.
Expand Down

0 comments on commit abf9a6e

Please sign in to comment.