rust/hwphysics/src/grid.rs
changeset 16113 36862a9ec59b
parent 16010 5ba4d3a0c3eb
--- a/rust/hwphysics/src/grid.rs	Mon Feb 03 16:32:44 2025 +0100
+++ b/rust/hwphysics/src/grid.rs	Mon Feb 03 16:52:05 2025 +0100
@@ -35,7 +35,7 @@
     }
 }
 
-const GRID_BIN_SIZE: usize = 128;
+const GRID_BIN_SIZE: u32 = 128;
 
 pub struct Grid {
     bins: Vec<GridBin>,
@@ -57,9 +57,9 @@
         }
     }
 
-    fn linear_bin_index(&self, index: Point) -> usize {
+    fn linear_bin_index(&self, index: Point) -> u32 {
         self.bins_count
-            .linear_index(index.x as usize, index.y as usize)
+            .linear_index(index.x as u32, index.y as u32)
     }
 
     fn bin_index(&self, position: &FPPoint) -> Point {
@@ -68,12 +68,12 @@
 
     fn get_bin(&mut self, index: Point) -> &mut GridBin {
         let index = self.linear_bin_index(index);
-        &mut self.bins[index]
+        &mut self.bins[index as usize]
     }
 
     fn try_get_bin(&mut self, index: Point) -> Option<&mut GridBin> {
         let index = self.linear_bin_index(index);
-        self.bins.get_mut(index)
+        self.bins.get_mut(index as usize)
     }
 
     fn lookup_bin(&mut self, position: &FPPoint) -> &mut GridBin {