Index: tests/bitmanip.cfa
===================================================================
--- tests/bitmanip.cfa	(revision 03eabf482e5459c81efc9cecd2bfb8190e0bad34)
+++ tests/bitmanip.cfa	(revision 03eabf482e5459c81efc9cecd2bfb8190e0bad34)
@@ -0,0 +1,413 @@
+#include <fstream.hfa>
+#include "bitmanip.hfa"
+
+int main() {
+    signed char sc;
+    unsigned char usc;
+    short int si;
+    unsigned short int usi;
+    int i;
+    unsigned int ui;
+    long int li;
+    unsigned long int uli;
+    long long int lli;
+    unsigned long long int ulli;
+
+    sout | nlOff;
+
+    //============================================================
+
+    sout | "cl0" | nl;
+
+    sc = 0;
+    sout | sc | cl0( sc ) | ",";
+    for ( sc = 1; sc != 0; sc <<= 1 ) {
+	sout | sc | cl0( sc ) | ",";
+    }
+    sout | nl;
+    usc = 0;
+    sout | usc | cl0( usc ) | ",";
+    for ( usc = 1; usc != 0; usc <<= 1 ) {
+	sout | usc | cl0( usc ) | ",";
+    }
+    sout | nl;
+
+    si = 0;
+    sout | si | cl0( si ) | ",";
+    for ( si = 1; si != 0; si <<= 1 ) {
+	sout | si | cl0( si ) | ",";
+    }
+    sout | nl;
+    usi = 0;
+    sout | usi | cl0( usi ) | ",";
+    for ( usi = 1; usi != 0; usi <<= 1 ) {
+	sout | usi | cl0( usi ) | ",";
+    }
+    sout | nl;
+
+    i = 0;
+    sout | i | cl0( i ) | ",";
+    for ( i = 1; i != 0; i <<= 1 ) {
+	sout | i | cl0( i ) | ",";
+    }
+    sout | nl;
+    ui = 0;
+    sout | ui | cl0( ui ) | ",";
+    for ( ui = 1; ui != 0; ui <<= 1 ) {
+	sout | ui | cl0( ui ) | ",";
+    }
+    sout | nl;
+
+    li = 0;
+    sout | li | cl0( li ) | ",";
+    for ( li = 1; li != 0; li <<= 1 ) {
+	sout | li | cl0( li ) | ",";
+    }
+    sout | nl;
+    uli = 0;
+    sout | uli | cl0( uli ) | ",";
+    for ( uli = 1; uli != 0; uli <<= 1 ) {
+	sout | uli | cl0( uli ) | ",";
+    }
+    sout | nl;
+
+    lli = 0;
+    sout | lli | cl0( lli ) | ",";
+    for ( lli = 1; lli != 0; lli <<= 1 ) {
+	sout | lli | cl0( lli ) | ",";
+    }
+    sout | nl;
+    ulli = 0;
+    sout | ulli | cl0( ulli ) | ",";
+    for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+	sout | ulli | cl0( ulli ) | ",";
+    }
+    sout | nl;
+
+    //============================================================
+
+    sout | nl | "ct0" | nl;
+
+    sc = 0;
+    sout | sc | ct0( sc ) | ",";
+    for ( sc = 1; sc != 0; sc <<= 1 ) {
+	sout | sc | ct0( sc ) | ",";
+    }
+    sout | nl;
+    usc = 0;
+    sout | usc | ct0( usc ) | ",";
+    for ( usc = 1; usc != 0; usc <<= 1 ) {
+	sout | usc | ct0( usc ) | ",";
+    }
+    sout | nl;
+
+    si = 0;
+    sout | si | ct0( si ) | ",";
+    for ( si = 1; si != 0; si <<= 1 ) {
+	sout | si | ct0( si ) | ",";
+    }
+    sout | nl;
+    usi = 0;
+    sout | usi | ct0( usi ) | ",";
+    for ( usi = 1; usi != 0; usi <<= 1 ) {
+	sout | usi | ct0( usi ) | ",";
+    }
+    sout | nl;
+
+    i = 0;
+    sout | i | ct0( i ) | ",";
+    for ( i = 1; i != 0; i <<= 1 ) {
+	sout | i | ct0( i ) | ",";
+    }
+    sout | nl;
+    ui = 0;
+    sout | ui | ct0( ui ) | ",";
+    for ( ui = 1; ui != 0; ui <<= 1 ) {
+	sout | ui | ct0( ui ) | ",";
+    }
+    sout | nl;
+
+    li = 0;
+    sout | li | ct0( li ) | ",";
+    for ( li = 1; li != 0; li <<= 1 ) {
+	sout | li | ct0( li ) | ",";
+    }
+    sout | nl;
+    uli = 0;
+    sout | uli | ct0( uli ) | ",";
+    for ( uli = 1; uli != 0; uli <<= 1 ) {
+	sout | uli | ct0( uli ) | ",";
+    }
+    sout | nl;
+
+    lli = 0;
+    sout | lli | ct0( lli ) | ",";
+    for ( lli = 1; lli != 0; lli <<= 1 ) {
+	sout | lli | ct0( lli ) | ",";
+    }
+    sout | nl;
+    ulli = 0;
+    sout | ulli | ct0( ulli ) | ",";
+    for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+	sout | ulli | ct0( ulli ) | ",";
+    }
+    sout | nl;
+
+    //============================================================
+
+    sout | nl | "ca1" | nl;
+
+    sc = 0;
+    for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, sc = (sc << 1) + 1 ) {
+	sout | sc | ca1( sc ) | ",";
+    }
+    sout | nl;
+    usc = 0;
+    for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, usc = (usc << 1) + 1 ) {
+	sout | usc | ca1( usc ) | ",";
+    }
+    sout | nl;
+
+    si = 0;
+    for ( int p = 0; p < sizeof(si) * __CHAR_BIT__ + 1; p += 1, si = (si << 1) + 1 ) {
+	sout | si | ca1( si ) | ",";
+    }
+    sout | nl;
+    usi = 0;
+    for ( int p = 0; p < sizeof(usi) * __CHAR_BIT__ + 1; p += 1, usi = (usi << 1) + 1 ) {
+	sout | usi | ca1( usi ) | ",";
+    }
+    sout | nl;
+
+    i = 0;
+    for ( int p = 0; p < sizeof(i) * __CHAR_BIT__ + 1; p += 1, i = (i << 1) + 1 ) {
+	sout | i | ca1( i ) | ",";
+    }
+    sout | nl;
+    ui = 0;
+    for ( int p = 0; p < sizeof(ui) * __CHAR_BIT__ + 1; p += 1, ui = (ui << 1) + 1 ) {
+	sout | ui | ca1( ui ) | ",";
+    }
+    sout | nl;
+
+    li = 0;
+    for ( int p = 0; i < sizeof(li) * __CHAR_BIT__ + 1; p += 1, li = (li << 1) + 1 ) {
+	sout | li | ca1( li ) | ",";
+    }
+    sout | nl;
+    uli = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, uli = (uli << 1) + 1 ) {
+	sout | uli | ca1( uli ) | ",";
+    }
+    sout | nl;
+
+    lli = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, lli = (lli << 1) + 1 ) {
+	sout | lli | ca1( lli ) | ",";
+    }
+    sout | nl;
+    ulli = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, ulli = (ulli << 1) + 1 ) {
+	sout | ulli | ca1( ulli ) | ",";
+    }
+    sout | nl;
+
+    //============================================================
+
+    sout | nl | "ca0" | nl;
+
+    sc = 0;
+    for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, sc = (sc << 1) + 1 ) {
+	sout | sc | ca0( sc ) | ",";
+    }
+    sout | nl;
+    usc = 0;
+    for ( int p = 0; p < sizeof(sc) * __CHAR_BIT__ + 1; p += 1, usc = (usc << 1) + 1 ) {
+	sout | usc | ca0( usc ) | ",";
+    }
+    sout | nl;
+
+    si = 0;
+    for ( int p = 0; p < sizeof(si) * __CHAR_BIT__ + 1; p += 1, si = (si << 1) + 1 ) {
+	sout | si | ca0( si ) | ",";
+    }
+    sout | nl;
+    usi = 0;
+    for ( int p = 0; p < sizeof(si) * __CHAR_BIT__ + 1; p += 1, usi = (usi << 1) + 1 ) {
+	sout | usi | ca0( usi ) | ",";
+    }
+    sout | nl;
+
+    i = 0;
+    for ( int p = 0; p < sizeof(i) * __CHAR_BIT__ + 1; p += 1, i = (i << 1) + 1 ) {
+	sout | i | ca0( i ) | ",";
+    }
+    sout | nl;
+    ui = 0;
+    for ( int p = 0; p < sizeof(ui) * __CHAR_BIT__ + 1; p += 1, ui = (ui << 1) + 1 ) {
+	sout | ui | ca0( ui ) | ",";
+    }
+    sout | nl;
+
+    li = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, li = (li << 1) + 1 ) {
+	sout | li | ca0( li ) | ",";
+    }
+    sout | nl;
+    uli = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, uli = (uli << 1) + 1 ) {
+	sout | uli | ca0( uli ) | ",";
+    }
+    sout | nl;
+
+    lli = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, lli = (lli << 1) + 1 ) {
+	sout | lli | ca0( lli ) | ",";
+    }
+    sout | nl;
+    ulli = 0;
+    for ( int p = 0; p < sizeof(li) * __CHAR_BIT__ + 1; p += 1, ulli = (ulli << 1) + 1 ) {
+	sout | ulli | ca0( ulli ) | ",";
+    }
+    sout | nl;
+
+    //============================================================
+
+    sout | nl | "fls" | nl;
+
+    sc = 0;
+    sout | sc | fls( sc ) | ",";
+    for ( sc = 1; sc != 0; sc <<= 1 ) {
+	sout | sc | fls( sc ) | ",";
+    }
+    sout | nl;
+    usc = 0;
+    sout | usc | fls( usc ) | ",";
+    for ( usc = 1; usc != 0; usc <<= 1 ) {
+	sout | usc | fls( usc ) | ",";
+    }
+    sout | nl;
+
+    si = 0;
+    sout | si | fls( si ) | ",";
+    for ( si = 1; si != 0; si <<= 1 ) {
+	sout | si | fls( si ) | ",";
+    }
+    sout | nl;
+    usi = 0;
+    sout | usi | fls( usi ) | ",";
+    for ( usi = 1; usi != 0; usi <<= 1 ) {
+	sout | usi | fls( usi ) | ",";
+    }
+    sout | nl;
+
+    i = 0;
+    sout | i | fls( i ) | ",";
+    for ( i = 1; i != 0; i <<= 1 ) {
+	sout | i | fls( i ) | ",";
+    }
+    sout | nl;
+    ui = 0;
+    sout | ui | fls( ui ) | ",";
+    for ( ui = 1; ui != 0; ui <<= 1 ) {
+	sout | ui | fls( ui ) | ",";
+    }
+    sout | nl;
+
+    li = 0;
+    sout | li | fls( li ) | ",";
+    for ( li = 1; li != 0; li <<= 1 ) {
+	sout | li | fls( li ) | ",";
+    }
+    sout | nl;
+    uli = 0;
+    sout | uli | fls( uli ) | ",";
+    for ( uli = 1; uli != 0; uli <<= 1 ) {
+	sout | uli | fls( uli ) | ",";
+    }
+    sout | nl;
+
+    lli = 0;
+    sout | lli | fls( lli ) | ",";
+    for ( lli = 1; lli != 0; lli <<= 1 ) {
+	sout | lli | fls( lli ) | ",";
+    }
+    sout | nl;
+    ulli = 0;
+    sout | ulli | fls( ulli ) | ",";
+    for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+	sout | ulli | fls( ulli ) | ",";
+    }
+    sout | nl;
+
+    //============================================================
+
+    sout | nl | "fms" | nl;
+
+    sc = 0;
+    sout | sc | fms( sc ) | ",";
+    for ( sc = 1; sc != 0; sc <<= 1 ) {
+	sout | sc | fms( sc ) | ",";
+    }
+    sout | nl;
+    usc = 0;
+    sout | usc | fms( usc ) | ",";
+    for ( usc = 1; usc != 0; usc <<= 1 ) {
+	sout | usc | fms( usc ) | ",";
+    }
+    sout | nl;
+
+    si = 0;
+    sout | si | fms( si ) | ",";
+    for ( si = 1; si != 0; si <<= 1 ) {
+	sout | si | fms( si ) | ",";
+    }
+    sout | nl;
+    usi = 0;
+    sout | usi | fms( usi ) | ",";
+    for ( usi = 1; usi != 0; usi <<= 1 ) {
+	sout | usi | fms( usi ) | ",";
+    }
+    sout | nl;
+
+    i = 0;
+    sout | i | fms( i ) | ",";
+    for ( i = 1; i != 0; i <<= 1 ) {
+	sout | i | fms( i ) | ",";
+    }
+    sout | nl;
+    ui = 0;
+    sout | ui | fms( ui ) | ",";
+    for ( ui = 1; ui != 0; ui <<= 1 ) {
+	sout | ui | fms( ui ) | ",";
+    }
+    sout | nl;
+
+    li = 0;
+    sout | li | fms( li ) | ",";
+    for ( li = 1; li != 0; li <<= 1 ) {
+	sout | li | fms( li ) | ",";
+    }
+    sout | nl;
+    uli = 0;
+    sout | uli | fms( uli ) | ",";
+    for ( uli = 1; uli != 0; uli <<= 1 ) {
+	sout | uli | fms( uli ) | ",";
+    }
+    sout | nl;
+
+    lli = 0;
+    sout | lli | fms( lli ) | ",";
+    for ( lli = 1; lli != 0; lli <<= 1 ) {
+	sout | lli | fms( lli ) | ",";
+    }
+    sout | nl;
+    ulli = 0;
+    sout | ulli | fms( ulli ) | ",";
+    for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+	sout | ulli | fms( ulli ) | ",";
+    }
+    sout | nl;
+#if 0
+#endif // 0
+}
