typedef unsigned int uint32_t; typedef unsigned char uint8_t; void foo (uint32_t *src, uint8_t *c, uint32_t bytes) { uint8_t *ctarget; for (;;) { c[0] = src[0] & 0xff; if (bytes <= 8) { if (bytes < 8) { ctarget[4] = c[4]; } return; } bytes -= 8; c += 8; } }