summaryrefslogtreecommitdiff
path: root/src/disk/block.rs
diff options
context:
space:
mode:
authorChuyan Zhang <me@zcy.moe>2023-11-26 02:33:01 -0800
committerChuyan Zhang <me@zcy.moe>2023-11-26 02:33:01 -0800
commit9d1368b0ea380a9446b4697af668d1685464b6c7 (patch)
tree2103af418264cc70addc9cfc6ed7acac640f5151 /src/disk/block.rs
parent777d5e01a34b8ebe6f1a5751b593266f93e88499 (diff)
downloadmyfs-9d1368b0ea380a9446b4697af668d1685464b6c7.tar.gz
myfs-9d1368b0ea380a9446b4697af668d1685464b6c7.zip
more code idk what they are im so tired ohno
Diffstat (limited to 'src/disk/block.rs')
-rw-r--r--src/disk/block.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/disk/block.rs b/src/disk/block.rs
index be3d85a..26a7ec5 100644
--- a/src/disk/block.rs
+++ b/src/disk/block.rs
@@ -120,10 +120,12 @@ impl DirectoryBlock {
}
pub(crate) fn query(&self, mut index: usize) -> bool {
- if index < 7 { // 0-6, first u8
+ if index < 7 {
+ // 0-6, first u8
index = index + 1;
self.occupancy[0] & (1 << (7 - index)) as u8 != 0
- } else if index < 15 { // 7-14, second u8
+ } else if index < 15 {
+ // 7-14, second u8
index = index - 7;
self.occupancy[1] & (1 << (7 - index)) as u8 != 0
} else {
@@ -149,7 +151,8 @@ impl DirectoryBlock {
if index < 7 {
index = index + 1;
self.occupancy[0] &= !((1 << (7 - index)) as u8);
- } else if index < 15 { // 7-14, second u8
+ } else if index < 15 {
+ // 7-14, second u8
index = index - 7;
self.occupancy[1] &= !((1 << (7 - index)) as u8);
}