File: byte_copyr.c

package info (click to toggle)
libowfat 0.34-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,288 kB
  • sloc: ansic: 20,181; makefile: 16
file content (19 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#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, size_t 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;
  }
}