Write SqlDbLayer
This commit is contained in:
1 parent
8ec7c8f05d
commit
45830a7985
7 files changed
+150
-19
No files matched your search
@@ -185,7 +185,7 @@ impl CardStatistics {
|
||||
#[derive(Copy)]
|
||||
pub struct EntityHandle<E> {
|
||||
pub(crate) id: Id,
|
||||
index: i32,
|
||||
index: u32,
|
||||
pub(crate) _phantom: PhantomData<E>,
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ impl<T> EntityHandle<T> {
|
||||
pub fn new(id: Id, index: usize, real: bool) -> Self {
|
||||
Self {
|
||||
id,
|
||||
index: index as i32 | (!real as i32) << 31,
|
||||
index: ((index as u32) << 1 >> 1) | (!real as u32) << 31,
|
||||
_phantom: Default::default(),
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ impl<T> EntityHandle<T> {
|
||||
}
|
||||
|
||||
pub fn set_index(&mut self, index: usize) {
|
||||
self.index = self.index >> 31 << 31 | index as i32;
|
||||
self.index = (self.index >> 31 << 31) | ((index as u32) << 1 >> 1);
|
||||
}
|
||||
|
||||
pub fn real(&self) -> bool {
|
||||
@@ -219,7 +219,7 @@ impl<T> EntityHandle<T> {
|
||||
}
|
||||
|
||||
pub fn set_real(&mut self, value: bool) {
|
||||
self.index = self.index << 1 >> 1 | (!value as i32) << 31;
|
||||
self.index = self.index << 1 >> 1 | (!value as u32) << 31;
|
||||
}
|
||||
}
|
||||
impl<T> Eq for EntityHandle<T> {}
|
||||
|
||||
Reference in new issue
Block a user