Detemplateify intToHexString
The routine of intToHexString is mostly common between all the
various implementations, the only difference is in selecting a
reasonable default size for the type. This commit moves to a common
method, so the templates don't get created for each and every
instantiation of intToHexString, and simplifies our code.
This saves a trivial amount (428 bytes) of compressed binary size.
Tested: Unit tests passing, and have good coverage of this.
Memory resources return the values as were there previously.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6945a81a5e03c7a64d6a2a0629b24db941271930
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 654a08b..b74b05c 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -153,7 +153,7 @@
if (value != nullptr)
{
aResp->res.jsonValue["ProcessorId"]["EffectiveFamily"] =
- "0x" + intToHexString(*value);
+ "0x" + intToHexString(*value, 4);
}
}
else if (property.first == "EffectiveModel")
@@ -165,7 +165,7 @@
return;
}
aResp->res.jsonValue["ProcessorId"]["EffectiveModel"] =
- "0x" + intToHexString(*value);
+ "0x" + intToHexString(*value, 4);
}
else if (property.first == "Id")
{
@@ -174,7 +174,7 @@
{
aResp->res
.jsonValue["ProcessorId"]["IdentificationRegisters"] =
- "0x" + intToHexString(*value);
+ "0x" + intToHexString(*value, 16);
}
}
else if (property.first == "Microcode")
@@ -186,7 +186,7 @@
return;
}
aResp->res.jsonValue["ProcessorId"]["MicrocodeInfo"] =
- "0x" + intToHexString(*value);
+ "0x" + intToHexString(*value, 8);
}
else if (property.first == "Step")
{
@@ -197,7 +197,7 @@
return;
}
aResp->res.jsonValue["ProcessorId"]["Step"] =
- "0x" + intToHexString(*value);
+ "0x" + intToHexString(*value, 4);
}
}
}