| 64 | |
| 65 | |
| 66 | bool SparseArray::set(uint16_t x, float value) |
| 67 | { |
| 68 | int32_t pos = findPos(x); |
| 69 | // existing element |
| 70 | if (pos > -1) |
| 71 | { |
| 72 | _value[pos] = value; |
| 73 | if (_value[pos] == 0.0) removeElement(pos); |
| 74 | return true; |
| 75 | } |
| 76 | |
| 77 | // does not exist => new element ? |
| 78 | return newElement(x, value); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | bool SparseArray::add(uint16_t x, float value) |