Yes, this is a bug.
The expanded code correctly gets the length, then subtracts 1 from it,
for reasons I can't quite understand at the moment ...
Rich.
--
Richard Jones
Red Hat
Actually that's not the right explanation.
It seems like the 'as' syntax is binding the wrong thing. It takes me
some time to get back "into" bitstring because the syntax extension is
complex. But yes, this is surely a bug.
Please try the following commit which should fix this issue:
https://code.google.com/p/bitstring/source/detail?r=189