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
10const FAN_LEN: usize = 256;10const FAN_LEN: usize = 256;
11const V1_HEADER_SIZE: usize = FAN_LEN * N32_SIZE;11const V1_HEADER_SIZE: usize = FAN_LEN * N32_SIZE;
12const V2_HEADER_SIZE: usize = N32_SIZE * 2 + FAN_LEN * N32_SIZE;12const V2_HEADER_SIZE: usize = N32_SIZE * 2 + FAN_LEN * N32_SIZE;
13const MAX_N31: u32 = u32::max_value() >> 1;13const N32_HIGH_BIT: u32 = 1 << 31;
14 14
15quick_error! {15quick_error! {
16 #[derive(Debug)]16 #[derive(Debug)]
@@ -115,8 +115,8 @@ impl File { · 98 unmodified lines
115 oid: object::id_from_20_bytes(oid),115 oid: object::id_from_20_bytes(oid),
116 offset: {116 offset: {
117 let ofs32 = BigEndian::read_u32(ofs32);117 let ofs32 = BigEndian::read_u32(ofs32);
118 if ofs32 > MAX_N31 {118 if (ofs32 & N32_HIGH_BIT) == N32_HIGH_BIT {
119 let from = pack64_offset + (ofs32 ^ 0b10000000_00000000_00000000_00000000) as usize * N64_SIZE;119 let from = pack64_offset + (ofs32 ^ N32_HIGH_BIT) as usize * N64_SIZE;
120 BigEndian::read_u64(&self.data[from..from + N64_SIZE])120 BigEndian::read_u64(&self.data[from..from + N64_SIZE])
121 } else {121 } else {
122 ofs32 as u64122 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