Use memset instead of nested for-loop to zero a 2d array

Saves 26 bytes of flash memory and removes two 'int' types
This commit is contained in:
Guðni Már Gilbert 2021-08-02 19:20:51 +00:00
parent 2554d21925
commit a54a133968
1 changed files with 1 additions and 3 deletions

View File

@ -10,9 +10,7 @@ mesh_bed_leveling::mesh_bed_leveling() { reset(); }
void mesh_bed_leveling::reset() {
active = 0;
for (int y = 0; y < MESH_NUM_Y_POINTS; y++)
for (int x = 0; x < MESH_NUM_X_POINTS; x++)
z_values[y][x] = 0;
memset(z_values, 0, sizeof(float) * MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS);
}
static inline bool vec_undef(const float v[2])