bit setter correction
This commit is contained in:
parent
85cc936d5d
commit
3a85001855
@ -42,7 +42,7 @@ ReturnValue_t LocalDataSet::serializeWithValidityBuffer(uint8_t **buffer,
|
||||
if(registeredVariables[count]->isValid()) {
|
||||
// set validity buffer here.
|
||||
this->bitSetter(validityMask + validBufferIndex,
|
||||
validBufferIndexBit, true);
|
||||
validBufferIndexBit);
|
||||
if(validBufferIndexBit == 7) {
|
||||
validBufferIndex ++;
|
||||
validBufferIndexBit = 0;
|
||||
@ -83,13 +83,12 @@ ReturnValue_t LocalDataSet::serializeLocalPoolIds(uint8_t** buffer,
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void LocalDataSet::bitSetter(uint8_t* byte, uint8_t position,
|
||||
bool value) const {
|
||||
void LocalDataSet::bitSetter(uint8_t* byte, uint8_t position) const {
|
||||
if(position > 7) {
|
||||
sif::debug << "Pool Raw Access: Bit setting invalid position" << std::endl;
|
||||
return;
|
||||
}
|
||||
uint8_t shiftNumber = position + (7 - 2 * position);
|
||||
*byte |= 1UL << shiftNumber;
|
||||
*byte |= 1 << shiftNumber;
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,10 @@ private:
|
||||
LocalDataPoolManager* hkManager;
|
||||
|
||||
/**
|
||||
* Sets the bit at the bit-position of a byte provided by its address
|
||||
* to the specified value (zero or one).
|
||||
* @param byte Pointer to byte to bitset.
|
||||
* @param position MSB first, 0 to 7 possible.
|
||||
* @param value Value to set.
|
||||
* @return
|
||||
* Set n-th bit of a byte, with n being the position from 0
|
||||
* (most significant bit) to 7 (least significant bit)
|
||||
*/
|
||||
void bitSetter(uint8_t* byte, uint8_t position, bool value) const;
|
||||
void bitSetter(uint8_t* byte, uint8_t position) const;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_DATAPOOLLOCAL_LOCALDATASET_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user