Prechádzať zdrojové kódy

Updated GenBits.

Use .fill.
Bugz 1 týždeň pred
rodič
commit
7b3902051c
2 zmenil súbory, kde vykonal 10 pridanie a 5 odobranie
  1. 4 5
      sudoku/Cargo.toml
  2. 6 0
      sudoku/src/bits.rs

+ 4 - 5
sudoku/Cargo.toml

@@ -6,7 +6,6 @@ edition = "2021"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-bit_field = "0.10.2"
 num = "0.4.3"
 rand = "0.8.5"
 rand_chacha = "0.3.1"
@@ -18,9 +17,9 @@ xml = "0.8.20"
 name = "sudoku"
 test = true
 
-[source.crates-io]
-replace-with = "vendored-sources"
+# [source.crates-io]
+# replace-with = "vendored-sources"
 
-[source.vendored-sources]
-directory = "vendor"
+# [source.vendored-sources]
+# directory = "vendor"
 

+ 6 - 0
sudoku/src/bits.rs

@@ -15,15 +15,21 @@ impl GenBits {
     }
 
     pub fn clear(&mut self) {
+        self.0.fill(false);
+        /* 
         for i in 0..self.0.len() {
             self.0[i] = false;
         }
+        */
     }
 
     pub fn fill(&mut self, value: bool) {
+        self.0.fill(value);
+        /*
         for i in 0..self.0.len() {
             self.0[i] = value;
         }
+        */
     }
 
     pub fn set(&mut self, bit: usize, state: bool) {