MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / add

Method add

libraries/SparseMatrix/SparseMatrix.cpp:84–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83
84bool SparseMatrix::add(uint8_t x, uint8_t y, float value)
85{
86 int32_t pos = findPos(x, y);
87 // existing element
88 if (pos > -1)
89 {
90 _value[pos] += value;
91 if (_value[pos] == 0.0) removeElement(pos);
92 return true;
93 }
94
95 // does not exist => new element ?
96 return newElement(x, y, value);
97}
98
99
100float SparseMatrix::get(uint8_t x, uint8_t y)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36