Skip to content

Commit

Permalink
remove manually unrolled loops in byte*.c
Browse files Browse the repository at this point in the history
The compiler will know when this helps or not.
  • Loading branch information
DerDakon committed Apr 26, 2024
1 parent dda75f8 commit 0982496
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions byte_cr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ void byte_copyr(char *to, unsigned int n, char *from)
from += n;
for (;;) {
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
}
}
3 changes: 0 additions & 3 deletions byte_rchr.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ unsigned int byte_rchr(char *s, unsigned int n, int c)
u = 0;
for (;;) {
if (!n) break; if (*t == ch) u = t; ++t; --n;
if (!n) break; if (*t == ch) u = t; ++t; --n;
if (!n) break; if (*t == ch) u = t; ++t; --n;
if (!n) break; if (*t == ch) u = t; ++t; --n;
}
if (!u) u = t;
return u - s;
Expand Down
3 changes: 0 additions & 3 deletions byte_zero.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ void byte_zero(char *s, unsigned int n)
{
for (;;) {
if (!n) break; *s++ = 0; --n;
if (!n) break; *s++ = 0; --n;
if (!n) break; *s++ = 0; --n;
if (!n) break; *s++ = 0; --n;
}
}

0 comments on commit 0982496

Please sign in to comment.