Use the full Fingerprint when stringifying Svh
This commit is contained in:
parent
43a78029b4
commit
3c6d9ec77d
3 changed files with 11 additions and 6 deletions
|
@ -64,6 +64,11 @@ impl Fingerprint {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub(crate) fn as_u128(self) -> u128 {
|
||||||
|
u128::from(self.1) << 64 | u128::from(self.0)
|
||||||
|
}
|
||||||
|
|
||||||
// Combines two hashes in an order independent way. Make sure this is what
|
// Combines two hashes in an order independent way. Make sure this is what
|
||||||
// you want.
|
// you want.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -23,18 +23,18 @@ impl Svh {
|
||||||
Svh { hash }
|
Svh { hash }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_u64(&self) -> u64 {
|
pub fn as_u128(self) -> u128 {
|
||||||
self.hash.to_smaller_hash().as_u64()
|
self.hash.as_u128()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_string(&self) -> String {
|
pub fn to_hex(self) -> String {
|
||||||
format!("{:016x}", self.hash.to_smaller_hash())
|
format!("{:032x}", self.hash.as_u128())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Svh {
|
impl fmt::Display for Svh {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.pad(&self.to_string())
|
f.pad(&self.to_hex())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
|
||||||
let mut new_sub_dir_name = String::from(&old_sub_dir_name[..=dash_indices[2]]);
|
let mut new_sub_dir_name = String::from(&old_sub_dir_name[..=dash_indices[2]]);
|
||||||
|
|
||||||
// Append the svh
|
// Append the svh
|
||||||
base_n::push_str(svh.as_u64() as u128, INT_ENCODE_BASE, &mut new_sub_dir_name);
|
base_n::push_str(svh.as_u128(), INT_ENCODE_BASE, &mut new_sub_dir_name);
|
||||||
|
|
||||||
// Create the full path
|
// Create the full path
|
||||||
let new_path = incr_comp_session_dir.parent().unwrap().join(new_sub_dir_name);
|
let new_path = incr_comp_session_dir.parent().unwrap().join(new_sub_dir_name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue