From 25598f8bdbd63dd96194fd3f43dd53dd814cd1c0 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Thu, 12 Apr 2018 07:08:08 +0800 Subject: BaseTools: merge towards minimum PCD MAX methods we have 5 different max val or max byte for PCDs. refactor and remove 2 methods. we need 3, as one computes for VOID* PCDs. Cc: Bob Feng 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/Workspace/DscBuildData.py | 30 +++++++++-------------- 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'BaseTools/Source/Python/Workspace/DscBuildData.py') diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 1ca8109b48..d6b8b761d6 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1542,25 +1542,19 @@ class DscBuildData(PlatformBuildClassObject): @staticmethod def GetPcdMaxSize(Pcd): + if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: + return MAX_SIZE_TYPE[Pcd.DatumType] + MaxSize = int(Pcd.MaxDatumSize,10) if Pcd.MaxDatumSize else 0 - if Pcd.DatumType not in ['BOOLEAN','UINT8','UINT16','UINT32','UINT64']: - if Pcd.PcdValueFromComm: - if Pcd.PcdValueFromComm.startswith("{") and Pcd.PcdValueFromComm.endswith("}"): - MaxSize = max([len(Pcd.PcdValueFromComm.split(",")),MaxSize]) - elif Pcd.PcdValueFromComm.startswith("\"") or Pcd.PcdValueFromComm.startswith("\'"): - MaxSize = max([len(Pcd.PcdValueFromComm)-2+1,MaxSize]) - elif Pcd.PcdValueFromComm.startswith("L\""): - MaxSize = max([2*(len(Pcd.PcdValueFromComm)-3+1),MaxSize]) - else: - MaxSize = max([len(Pcd.PcdValueFromComm),MaxSize]) - elif Pcd.DatumType not in ['BOOLEAN','UINT8']: - MaxSize = 1 - elif Pcd.DatumType == 'UINT16': - MaxSize = 2 - elif Pcd.DatumType == 'UINT32': - MaxSize = 4 - elif Pcd.DatumType == 'UINT64': - MaxSize = 8 + if Pcd.PcdValueFromComm: + if Pcd.PcdValueFromComm.startswith("{") and Pcd.PcdValueFromComm.endswith("}"): + return max([len(Pcd.PcdValueFromComm.split(",")),MaxSize]) + elif Pcd.PcdValueFromComm.startswith("\"") or Pcd.PcdValueFromComm.startswith("\'"): + return max([len(Pcd.PcdValueFromComm)-2+1,MaxSize]) + elif Pcd.PcdValueFromComm.startswith("L\""): + return max([2*(len(Pcd.PcdValueFromComm)-3+1),MaxSize]) + else: + return max([len(Pcd.PcdValueFromComm),MaxSize]) return MaxSize def GenerateSizeFunction(self,Pcd): -- cgit v1.2.3