summaryrefslogtreecommitdiffstats
path: root/parameter/IntegerParameterType.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-08-31 11:23:24 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:14:54 +0100
commit1387bda01b089d8e8df06339d9c15d53b3de6725 (patch)
treec8dd258fdff344e629433f89976ca573ff828c31 /parameter/IntegerParameterType.cpp
parent2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af (diff)
downloadexternal_parameter-framework-1387bda01b089d8e8df06339d9c15d53b3de6725.zip
external_parameter-framework-1387bda01b089d8e8df06339d9c15d53b3de6725.tar.gz
external_parameter-framework-1387bda01b089d8e8df06339d9c15d53b3de6725.tar.bz2
Min/max value computation; Tuning lock handling
BZ: 7466 - Min/max values are now correctly computed. They concern integer and fixed point parameters - tuning mode lock issue solved: created an AutoLock class for safe lock handling - added configuration files for a demo on Ubuntu environment - had AMIXER subsystem plugin compliant for derivation - LPE library: add carriage return on logs - removed obsolete files - some cosmetics Change-Id: Ife7a4799fd48dd4a1ca25dae666c4e453815881e Orig-Change-Id: I72fc5c1ff6abf638b43266a75bc00e21ad412349 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/16880 Reviewed-by: Mahe, Erwan <erwan.mahe@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/IntegerParameterType.cpp')
-rw-r--r--parameter/IntegerParameterType.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp
index 1f20c93..f3e447e 100644
--- a/parameter/IntegerParameterType.cpp
+++ b/parameter/IntegerParameterType.cpp
@@ -74,21 +74,30 @@ bool CIntegerParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializi
// Size
setSize(xmlElement.getAttributeInteger("Size") / 8);
+ // Size in bits
+ uint32_t uiUtilSizeInBits = getSize() << 3;
+
// Min / Max
if (_bSigned) {
+
+ // Signed means we have one less util bit
+ uiUtilSizeInBits--;
+
if (xmlElement.hasAttribute("Min")) {
_uiMin = (uint32_t)xmlElement.getAttributeSignedInteger("Min");
} else {
- _uiMin = 1UL << 31;
+ _uiMin = 1UL << uiUtilSizeInBits;
+
+ signExtend((int32_t&)_uiMin);
}
if (xmlElement.hasAttribute("Max")) {
_uiMax = (uint32_t)xmlElement.getAttributeSignedInteger("Max");
} else {
- _uiMax = (1UL << 31) - 1;
+ _uiMax = (1UL << uiUtilSizeInBits) - 1;
}
} else {
if (xmlElement.hasAttribute("Min")) {
@@ -103,7 +112,7 @@ bool CIntegerParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializi
_uiMax = xmlElement.getAttributeInteger("Max");
} else {
- _uiMax = (uint32_t)-1;
+ _uiMax = (uint32_t)((1UL << uiUtilSizeInBits) - 1);
}
}