Since my policy is never to fix one bug without introducing the possibility of others (lol), I also made some improvements to the code.
My apologies, Neil.
(As always, presented “as-is” and without warranty or implied fitness; use at your own risk.)
// Aligns a power of two to the next block.
let rec internal nextBlock (n:int)
match (n<=b) with
| true -> b
| _ -> nextBlock n (b*f) f
// Align to the next nibble.
let rec internal nextNibble (n:int) =
nextBlock n 16 16