Index: libcfa/src/iostream.cfa
===================================================================
--- libcfa/src/iostream.cfa	(revision e04559028c8ec85da6e7316d6251e92f1c8f07c8)
+++ libcfa/src/iostream.cfa	(revision 7fd71c78421f70cc3bc380f8fbcb5eb62a273834)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar 11 14:35:35 2020
-// Update Count     : 860
+// Last Modified On : Mon Apr 20 21:55:00 2020
+// Update Count     : 912
 //
 
@@ -29,4 +29,6 @@
 #include <complex.h>									// creal, cimag
 } // extern "C"
+
+#include <bitmanip.hfa>									// fms
 
 
@@ -459,8 +461,6 @@
 \
 		if ( f.base == 'b' || f.base == 'B' ) {			/* bespoke binary format */ \
-			int bits;													\
-			if ( f.val == (T){0} ) bits = 1;			/* force at least one bit to print */ \
-			else bits = sizeof(long long int) * 8 - __builtin_clzll( f.val ); /* position of most significant bit */ \
-			bits = bits > sizeof(f.val) * 8 ? sizeof(f.val) * 8 : bits; \
+			int bits = high1( f.val );					/* position of most significant bit */ \
+			if ( bits == 0 ) bits = 1;					/* 0 value => force one bit to print */ \
 			int spaces = f.wd - bits;					/* can be negative */ \
 			if ( ! f.flags.nobsdp ) { spaces -= 2; }	/* base prefix takes space */ \
@@ -565,28 +565,73 @@
 				fmt2.flags.pad0 = fmt2.flags.nobsdp = true;	\
 				if ( f.base == 'b' | f.base == 'B' ) { \
-					if ( f.wd > 64 ) fmt.wd = f.wd - 64; \
-					if ( f.flags.pc && f.pc > 64 ) fmt.pc = f.pc - 64; \
-					fmt2.wd = 64; \
+					if ( fmt.flags.pc && fmt.pc > 64 ) fmt.pc -= 64; \
+					if ( fmt.flags.left ) { \
+						fmt2.wd = fmt.wd; \
+						if ( fmt2.wd <= 64 ) { \
+							fmt2.wd = 64; \
+						} else { \
+							if ( fmt.pc > 0 ) { \
+								fmt2.wd -= fmt.pc; \
+							} else { \
+								fmt2.wd = fmt.wd - high1( msig ); \
+							} /* if */ \
+							if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \
+							if ( fmt2.wd < 0 ) fmt2.wd = 0; \
+							fmt2.flags.left = true; \
+							fmt.wd = 0; \
+						} /* if */ \
+						printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \
+						printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \
+					} else { \
+						fmt2.wd = 64; \
+						if ( fmt.wd > 64 ) fmt.wd -= 64; \
+						printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \
+						printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \
+					} /* if */ \
+					fmt2.pc = 64; fmt2.flags.pc = true;	\
+					printf( "left %d %d %x\n", fmt2.wd, fmt2.pc, fmt2.all ); \
 					(ostype &)(os | fmt | "" | fmt2); \
 				} else if ( f.base == 'o' ) { \
-					fmt.val = (unsigned long long int)fmt.val >> 2; \
-					if ( f.wd > 21 ) fmt.wd = f.wd - 21; \
-					if ( f.flags.pc && f.pc > 21 ) fmt.pc = f.pc - 21; \
-					fmt2.wd = 1; \
-					fmt2.val = ((msig & 0x3) << 1) + 1; \
-					(ostype &)(os | fmt | "" | fmt2); \
-					sepOff( os ); \
-					fmt2.wd = 21; \
-					fmt2.val = lsig & 0x7fffffffffffffff; \
-					(ostype &)(os | fmt2); \
+					if ( fmt.flags.pc && fmt.pc > 21 ) fmt.pc -= 21; \
+					if ( fmt.flags.left ) { \
+						fmt2.wd = fmt.wd; \
+						if ( fmt2.wd <= 21 ) { \
+							fmt2.wd = fmt2.pc = 16; fmt2.flags.pc = true; \
+						} else { \
+						} /* if */ \
+					} else { \
+						fmt.val = (unsigned long long int)fmt.val >> 2; \
+						if ( fmt.wd > 21 ) fmt.wd -= 21; \
+						if ( ! fmt.flags.nobsdp ) { if ( fmt.pc < fmt.wd ) fmt.wd -= 1; else fmt.pc -= 1; } \
+						fmt2.wd = 1; \
+						fmt2.val = ((msig & 0x3) << 1) + 1; \
+						(ostype &)(os | fmt | "" | fmt2); \
+						sepOff( os ); \
+						fmt2.wd = 21; \
+						fmt2.val = lsig & 0x7fffffffffffffff; \
+						(ostype &)(os | fmt2); \
+					} /* if */ \
 				} else { \
-					if ( f.flags.left ) { \
-						if ( f.wd > 16 ) fmt2.wd = f.wd - 16; \
-						fmt.wd = 16; \
+					if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; \
+					if ( fmt.flags.left ) { \
+						fmt2.wd = fmt.wd; \
+						if ( fmt2.wd <= 16 ) { \
+							fmt2.wd = 16; \
+						} else { \
+							if ( fmt.pc > 0 ) { \
+								fmt2.wd -= fmt.pc; \
+							} else { \
+								fmt2.wd = fmt.wd - ceiling2( high1( msig ), 4 ) / 4; \
+							} /* if */ \
+							if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \
+							if ( fmt2.wd < 0 ) fmt2.wd = 0; \
+							fmt2.flags.left = true; \
+							fmt.wd = 0; \
+						} /* if */ \
 					} else { \
-						if ( f.wd > 16 ) fmt.wd = f.wd - 16; \
-						if ( f.flags.pc && f.pc > 16 ) fmt.pc = f.pc - 16; \
 						fmt2.wd = 16; \
+						if ( fmt.wd > 16 ) fmt.wd -= 16; \
 					} /* if */ \
+					fmt2.pc = 16; fmt2.flags.pc = true; \
 					(ostype &)(os | fmt | "" | fmt2); \
 				} /* if */ \
