Skip to content

Commit

Permalink
Merge pull request #790 from uuid-rs/chore/fewer-shifts
Browse files Browse the repository at this point in the history
Reduce bitshifts in from_u64_pair
  • Loading branch information
KodrAus authored Jan 20, 2025
2 parents 4c785e5 + 62da97b commit 3a0a378
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,7 @@ impl Uuid {
/// );
/// ```
pub const fn from_u64_pair(high_bits: u64, low_bits: u64) -> Self {
Uuid::from_bytes([
(high_bits >> 56) as u8,
(high_bits >> 48) as u8,
(high_bits >> 40) as u8,
(high_bits >> 32) as u8,
(high_bits >> 24) as u8,
(high_bits >> 16) as u8,
(high_bits >> 8) as u8,
high_bits as u8,
(low_bits >> 56) as u8,
(low_bits >> 48) as u8,
(low_bits >> 40) as u8,
(low_bits >> 32) as u8,
(low_bits >> 24) as u8,
(low_bits >> 16) as u8,
(low_bits >> 8) as u8,
low_bits as u8,
])
Uuid::from_u128(((high_bits as u128) << 64) | low_bits as u128)
}

/// Creates a UUID using the supplied bytes.
Expand Down

0 comments on commit 3a0a378

Please sign in to comment.