History

refactor

Sebastian Thiel committed 6 years ago

Commit 9fc9fc01 parent 3b485b51 file · +3 −3Browse files

Unified · Split

git-odb/src/pack/index.rs+3−3
@@ -10,7 +10,7 @@ const N64_SIZE: usize = size_of::<u64>(); · 9 unmodified lines
1010 const FAN_LEN: usize = 256;
1111 const V1_HEADER_SIZE: usize = FAN_LEN * N32_SIZE;
1212 const V2_HEADER_SIZE: usize = N32_SIZE * 2 + FAN_LEN * N32_SIZE;
13−const MAX_N31: u32 = u32::max_value() >> 1;
13+const N32_HIGH_BIT: u32 = 1 << 31;
1414
1515 quick_error! {
1616 #[derive(Debug)]
@@ -115,8 +115,8 @@ impl File { · 98 unmodified lines
115115 oid: object::id_from_20_bytes(oid),
116116 offset: {
117117 let ofs32 = BigEndian::read_u32(ofs32);
118− if ofs32 > MAX_N31 {
119− let from = pack64_offset + (ofs32 ^ 0b10000000_00000000_00000000_00000000) as usize * N64_SIZE;
118+ if (ofs32 & N32_HIGH_BIT) == N32_HIGH_BIT {
119+ let from = pack64_offset + (ofs32 ^ N32_HIGH_BIT) as usize * N64_SIZE;
120120 BigEndian::read_u64(&self.data[from..from + N64_SIZE])
121121 } else {
122122 ofs32 as u64

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t