cc52ff563b79e3ba236dc561c645232eb1f26329 tdreszer Tue Apr 23 13:33:20 2013 -0700 Added a couple useful functions that will be needed by haplotypes code. diff --git src/inc/bits.h src/inc/bits.h index 8b119bd..e44d9a8 100644 --- src/inc/bits.h +++ src/inc/bits.h @@ -70,27 +70,38 @@ void bitOr(Bits *a, Bits *b, int bitCount); /* Or two bitmaps. Put result in a. */ int bitOrCount(Bits *a, Bits *b, int bitCount); // Without altering 2 bitmaps, count the OR'd bits. void bitXor(Bits *a, Bits *b, int bitCount); /* Xor two bitmaps. Put result in a. */ int bitXorCount(Bits *a, Bits *b, int bitCount); // Without altering 2 bitmaps, count the XOR'd bits. void bitNot(Bits *a, int bitCount); /* Flip all bits in a. */ +void bitReverseRange(Bits *bits, int startIx, int bitCount); +// Reverses bits in range (e.g. 110010 becomes 010011) + void bitPrint(Bits *a, int startIx, int bitCount, FILE* out); /* Print part or all of bit map as a string of 0s and 1s. Mostly useful for * debugging */ +void bitsOut(FILE* out, Bits *bits, int startIx, int bitCount, boolean onlyOnes); +// Print part or all of bit map as a string of 0s and 1s. Optionally only print 1s and [bracket]. +; +Bits *bitsIn(struct lm *lm,char *bitString, int len); +// Returns a bitmap from a string of 1s and 0s. Any non-zero, non-blank char sets a bit. +// Returned bitmap is the size of len even if that is longer than the string. +// Optionally supply local memory. + extern int bitsInByte[256]; /* Lookup table for how many bits are set in a byte. */ void bitsInByteInit(); /* Initialize bitsInByte array. */ #endif /* BITS_H */