环形缓存复制

2 views
Skip to first unread message

裴国兴

unread,
Nov 26, 2009, 3:36:08 AM11/26/09
to btload
void * bufcpy(void *dst, size_t len_dst, size_t off_dst,
const void *src, size_t len_src, size_t off_src, size_t count)
{
char *outp = (char*)dst;
const char *inp = (const char*)src;

assert ((count <= len_src) &&
(count <= len_dst));

while (count-- > 0) {
off_src %= len_src;
off_dst %= len_dst;
outp[off_dst++] = inp[off_src++];
}

return dst;
}

------------------------
环形缓存复制。
Reply all
Reply to author
Forward
0 new messages