File: byte_copyr.c

package info (click to toggle)
libowfat 0.22-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,148 kB
  • ctags: 976
  • sloc: ansic: 10,424; makefile: 42
file content (15 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#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] */
void byte_copyr(void* out, unsigned long len, const void* in) {
  register char* s=(char*)out+len;
  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;
  }
}