aboutsummaryrefslogtreecommitdiffstats
path: root/parameter/ParameterType.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/ParameterType.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/ParameterType.cpp')
-rw-r--r--parameter/ParameterType.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/parameter/ParameterType.cpp b/parameter/ParameterType.cpp
index 53d10e6..0d3dac5 100644
--- a/parameter/ParameterType.cpp
+++ b/parameter/ParameterType.cpp
@@ -125,21 +125,28 @@ void CParameterType::signExtend(int32_t& iData) const
// Check data has no bit set outside available range
bool CParameterType::isEncodable(uint32_t uiData) const
{
- uint32_t uiSizeInBits = _uiSize << 3;
- uint32_t uiShift = 32 - uiSizeInBits;
+ return isEncodable(uiData, _uiSize << 3);
+}
- if (uiShift) {
+// Check data has no bit set outside available range
+bool CParameterType::isEncodable(uint32_t uiData, uint32_t uiSizeInBits) const
+{
+ if (uiSizeInBits == 32) {
- // Check high bits are clean
- return !(uiData >> uiShift);
+ return true;
}
- return true;
+ // Check high bits are clean
+ return !(uiData >> uiSizeInBits);
}
// Remove all bits set outside available range
uint32_t CParameterType::makeEncodable(uint32_t uiData) const
{
+ if (_uiSize == sizeof(uint32_t)) {
+
+ return uiData;
+ }
uint32_t uiSizeInBits = _uiSize << 3;
uint32_t uiMask = (1 << uiSizeInBits) - 1;
@@ -147,21 +154,3 @@ uint32_t CParameterType::makeEncodable(uint32_t uiData) const
return uiData & uiMask;
}
-// Check data is consistent with available range, with respect to its sign
-bool CParameterType::isConsistent(uint32_t uiData, bool bSigned) const
-{
- uint32_t uiSizeInBits = _uiSize << 3;
- uint32_t uiShift = 32 - uiSizeInBits;
-
- if (uiShift) {
-
- // Negative value?
- bool bIsValueExpectedNegative = bSigned && (uiData & (1 << (uiShift - 1))) != 0;
-
- // Check high bits are clean
- return bIsValueExpectedNegative ? !(~uiData >> uiShift) : !(uiData >> uiShift);
- }
-
- return true;
-}
-