libowfat/byte/byte_copyr.c

16 lines
444 B
C
Raw Normal View History

2001-02-02 17:54:47 +00:00
#include "byte.h"
/* byte_copyr copies in[len-1] to out[len-1], in[len-2] to out[len-2],
* ... and in[0] to out[0] */
2006-11-07 17:56:05 +00:00
void byte_copyr(void* out, size_t len, const void* in) {
2001-11-24 21:27:21 +00:00
register char* s=(char*)out+len;
2001-02-02 17:54:47 +00:00
register const char* t=in;
register const char* u=t+len;
for (;;) {
if (t>=u) break; --u; --s; *s=*u;
if (t>=u) break; --u; --s; *s=*u;
if (t>=u) break; --u; --s; *s=*u;
if (t>=u) break; --u; --s; *s=*u;
}
}