
procedure foo(constref Buf: ShortInt; LH: Word; Count: SizeUInt; var Mask);
Hey... it's better than Rng

What it does? It take Count ShortInts from buffer and create a mask where each bit is set if element from buffer is in range set by parameter LH.
5 to 8 can be eliminated directly because it doesn't mention Mask.
It creates a mask. So... something like CreateMaskFromRange() or CreateMaskInRange().
This will be an external library? Otherwise why not just use Array as parameter (then there is no need for Count parameter).
If you need to keep Count, then I would switch the LH:Word and Count:SizeUInt parameters (Count directly after Buf).
And what is LH? A High AND Low parameter in one? Yeah... not really intuitive
