Skip to content

Commit

Permalink
Rename $conv_fn -> $large_unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 20, 2024
1 parent 0d526bd commit df33a85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const DEC_DIGITS_LUT: &[u8] = b"\
// Adaptation of the original implementation at
// https://github.com/rust-lang/rust/blob/b8214dc6c6fc20d0a660fb5700dca9ebf51ebe89/src/libcore/fmt/num.rs#L188-L266
macro_rules! impl_Integer {
($($max_len:expr => $t:ty),* as $conv_fn:ty) => {$(
($($max_len:expr => $t:ty),* as $large_unsigned:ty) => {$(
impl Integer for $t {
const MAX_STR_LEN: usize = $max_len;
}
Expand All @@ -148,10 +148,10 @@ macro_rules! impl_Integer {
fn write(self, buf: &mut [MaybeUninit<u8>; $max_len]) -> &str {
let is_nonnegative = self >= 0;
let mut n = if is_nonnegative {
self as $conv_fn
self as $large_unsigned
} else {
// Convert negative number to positive by summing 1 to its two's complement.
(!(self as $conv_fn)).wrapping_add(1)
(!(self as $large_unsigned)).wrapping_add(1)
};
let mut curr = buf.len() as isize;
let buf_ptr = buf.as_mut_ptr() as *mut u8;
Expand Down

0 comments on commit df33a85

Please sign in to comment.