From d3054be59ef0a4b007064c9d7844c1fbeed4443f Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Sat, 28 Apr 2018 06:32:41 +0800 Subject: BaseTools: Refactor to share GUID packing function Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'BaseTools') diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py index 8053202289..aee722d146 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -21,6 +21,7 @@ from Common.VariableAttributes import VariableAttributes import copy from struct import unpack from Common.DataType import * +from GenVar import PackGUID DATABASE_VERSION = 7 @@ -287,21 +288,7 @@ class DbItemList: # def PackGuid(GuidStructureValue): GuidString = GuidStructureStringToGuidString(GuidStructureValue) - Guid = GuidString.split('-') - Buffer = pack('=LHHBBBBBBBB', - int(Guid[0], 16), - int(Guid[1], 16), - int(Guid[2], 16), - int(Guid[3][-4:-2], 16), - int(Guid[3][-2:], 16), - int(Guid[4][-12:-10], 16), - int(Guid[4][-10:-8], 16), - int(Guid[4][-8:-6], 16), - int(Guid[4][-6:-4], 16), - int(Guid[4][-4:-2], 16), - int(Guid[4][-2:], 16) - ) - return Buffer + return PackGUID(GuidString.split('-')) if self.ItemSize == 8: PackStr = "=Q" -- cgit v1.2.3