Skip to content

Commit

Permalink
[CHUNKMEMSET_SAFE] Precalculate "from".
Browse files Browse the repository at this point in the history
  • Loading branch information
mtl1979 committed Jun 11, 2021
1 parent 4499d47 commit a89f3b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chunkset_tpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ Z_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) {

Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, unsigned left) {
if (left < (unsigned)(3 * sizeof(chunk_t))) {
uint8_t *from = out - dist;
while (len > 0) {
*out = *(out - dist);
out++;
*out++ = *from++;
--len;
}
return out;
Expand Down

0 comments on commit a89f3b9

Please sign in to comment.