/* For each bit oldbit in @orig, set bit oldbit mod @sz in @dst. Clear all other bits in @dst. See further the comment and Example  for bitmap_onto() for why and how to use this.  */
void bitmap_fold(unsigned long *dst, const unsigned long *orig, int sz, int bits)
/* For each bit oldbit in @orig, set bit oldbit mod @sz in @dst. Clear all other bits in @dst. See further the comment and Example  for bitmap_onto() for why and how to use this.  */
void bitmap_fold(unsigned long *dst, const unsigned long *orig, int sz, int bits)
{
	int oldbit;
	if (dst == orig)
		return;
	bitmap_zero(dst, bits);
	for (oldbit = find_first_bit(orig, bits);
	     oldbit < bits;
	     oldbit = find_next_bit(orig, bits, oldbit + 1))
		set_bit(oldbit % sz, dst);
}