Add GUID calculation function

This commit is contained in:
Nobody 2022-02-21 00:07:16 +05:00
parent 29996242ac
commit b128782ac2

View File

@ -46,4 +46,8 @@ impl IdManager {
pub fn get_entity_id_by_type_and_sub_id(t: &proto::ProtEntityType, sub_id: u32) -> u32 { pub fn get_entity_id_by_type_and_sub_id(t: &proto::ProtEntityType, sub_id: u32) -> u32 {
return ((*t as u32) << Self::ENTITY_ID_OFFSET) | (sub_id & Self::ENTITY_ID_MASK); return ((*t as u32) << Self::ENTITY_ID_OFFSET) | (sub_id & Self::ENTITY_ID_MASK);
} }
pub fn get_guid_by_uid_and_id(uid: u32, id: u32) -> u64 {
return (((uid as u64) << 32) | (id as u64));
}
} }