(&self, offset: usize, algo: HashAlgorithm)
| 465 | } |
| 466 | |
| 467 | fn oid_from_offset(&self, offset: usize, algo: HashAlgorithm) -> Option<ObjectID> { |
| 468 | let aparams = self.obj_formats.get(&algo)?; |
| 469 | |
| 470 | let mut hash = [0u8; GIT_MAX_RAWSZ]; |
| 471 | let len = algo.raw_len(); |
| 472 | let oid_off = aparams.full_off + (offset * len); |
| 473 | hash[0..len].copy_from_slice(&self.memory[oid_off..oid_off + len]); |
| 474 | Some(ObjectID { |
| 475 | hash, |
| 476 | algo: algo as u32, |
| 477 | }) |
| 478 | } |
| 479 | |
| 480 | fn u32_at_offset(slice: &[u8], offset: usize) -> u32 { |
| 481 | u32::from_be_bytes(slice[offset..offset + 4].try_into().unwrap()) |
no test coverage detected