Przeglądaj źródła

feat: Add update_sum method to Sstatus struct (#8)

LoGin 11 miesięcy temu
rodzic
commit
4241a97627
1 zmienionych plików z 9 dodań i 0 usunięć
  1. 9 0
      riscv/src/register/sstatus.rs

+ 9 - 0
riscv/src/register/sstatus.rs

@@ -99,6 +99,15 @@ impl Sstatus {
         self.bits & (1 << 18) != 0
     }
 
+    #[inline]
+    pub fn update_sum(&mut self, value: bool) {
+        if value {
+            self.bits |= 1 << 18;
+        } else {
+            self.bits &= !(1 << 18);
+        }
+    }
+
     /// Make eXecutable Readable
     #[inline]
     pub fn mxr(&self) -> bool {