diff options
author | Guillaume Denneulin <guillaume.denneulin@intel.com> | 2012-09-27 15:13:10 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-12 17:03:14 +0100 |
commit | 9533156ebad9b5989703db70be3f6bd22c9811c4 (patch) | |
tree | 13be07f704900c328300f8a386a212be0e9883d1 /parameter/BitParameterType.cpp | |
parent | 8b243f50a38a26e6b373287e07cb7e4743a8cd28 (diff) | |
download | external_parameter-framework-9533156ebad9b5989703db70be3f6bd22c9811c4.zip external_parameter-framework-9533156ebad9b5989703db70be3f6bd22c9811c4.tar.gz external_parameter-framework-9533156ebad9b5989703db70be3f6bd22c9811c4.tar.bz2 |
Allow 64bits bitParameterBlocks
BZ: 59348
bitParameterBlocks are limited to 32 bits, extend it to 64 bits.
This change includes:
- PFW code change
- XML schema update
Change-Id: I9861cea0538a17fcba77fa7d573faae36d8731e0
Signed-off-by: Guillaume Denneulin <guillaume.denneulin@intel.com>
Reviewed-on: http://android.intel.com:8080/68189
Reviewed-by: Gozalvez Herrero, Juan AntonioX <juan.antoniox.gozalvez.herrero@intel.com>
Tested-by: Gozalvez Herrero, Juan AntonioX <juan.antoniox.gozalvez.herrero@intel.com>
Diffstat (limited to 'parameter/BitParameterType.cpp')
-rw-r--r-- | parameter/BitParameterType.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/parameter/BitParameterType.cpp b/parameter/BitParameterType.cpp index 6c5a90f..20d29d3 100644 --- a/parameter/BitParameterType.cpp +++ b/parameter/BitParameterType.cpp @@ -31,7 +31,7 @@ #define base CTypeElement -CBitParameterType::CBitParameterType(const string& strName) : base(strName), _uiBitPos(0), _uiBitSize(0), _uiMax(uint32_t(-1)) +CBitParameterType::CBitParameterType(const string& strName) : base(strName), _uiBitPos(0), _uiBitSize(0), _uiMax(uint64_t(-1)) { } @@ -114,13 +114,13 @@ bool CBitParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingCo } // Conversion -bool CBitParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +bool CBitParameterType::toBlackboard(const string& strValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { // Hexa bool bValueProvidedAsHexa = !strValue.compare(0, 2, "0x"); // Get value - uint32_t uiConvertedValue = strtoul(strValue.c_str(), NULL, 0); + uint64_t uiConvertedValue = strtoull(strValue.c_str(), NULL, 0); if (uiConvertedValue > _uiMax) { @@ -149,9 +149,9 @@ bool CBitParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, return true; } -void CBitParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +void CBitParameterType::fromBlackboard(string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiConvertedValue = (uiValue & getMask()) >> _uiBitPos; + uint64_t uiConvertedValue = (uiValue & getMask()) >> _uiBitPos; // Format ostringstream strStream; @@ -169,7 +169,7 @@ void CBitParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue // Value access // Integer -bool CBitParameterType::toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +bool CBitParameterType::toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { if (uiUserValue > _uiMax) { @@ -184,7 +184,7 @@ bool CBitParameterType::toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CP return true; } -void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, CParameterAccessContext& parameterAccessContext) const +void CBitParameterType::fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const { (void)parameterAccessContext; @@ -192,7 +192,7 @@ void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, } // Access from area configuration -uint32_t CBitParameterType::merge(uint32_t uiOriginData, uint32_t uiNewData) const +uint64_t CBitParameterType::merge(uint64_t uiOriginData, uint64_t uiNewData) const { return (uiOriginData & ~getMask()) | (uiNewData & getMask()); } @@ -209,19 +209,19 @@ CInstanceConfigurableElement* CBitParameterType::doInstantiate() const } // Max value -uint32_t CBitParameterType::getMaxEncodableValue() const +uint64_t CBitParameterType::getMaxEncodableValue() const { - return (uint32_t)-1L >> (8 * sizeof(uint32_t) - _uiBitSize); + return (uint64_t)-1L >> (8 * sizeof(uint64_t) - _uiBitSize); } // Biwise mask -uint32_t CBitParameterType::getMask() const +uint64_t CBitParameterType::getMask() const { return getMaxEncodableValue() << _uiBitPos; } // Check data has no bit set outside available range -bool CBitParameterType::isEncodable(uint32_t uiData) const +bool CBitParameterType::isEncodable(uint64_t uiData) const { uint32_t uiShift = 8 * sizeof(uiData) - _uiBitSize; |