From b128782ac2a20b0c455b7275f123b376aea7f40e Mon Sep 17 00:00:00 2001 From: Nobody Date: Mon, 21 Feb 2022 00:07:16 +0500 Subject: [PATCH] Add GUID calculation function --- src/utils/id_manager.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/id_manager.rs b/src/utils/id_manager.rs index 533d5b1..a3d0cb8 100644 --- a/src/utils/id_manager.rs +++ b/src/utils/id_manager.rs @@ -46,4 +46,8 @@ impl IdManager { 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); } + + pub fn get_guid_by_uid_and_id(uid: u32, id: u32) -> u64 { + return (((uid as u64) << 32) | (id as u64)); + } }