On Saturday 20 July 2002 01:02, Andrew Rodland wrote:
> Thanks a million to the unnamed linux<AT>horizon.com for some great
> suggestions/info. v2 of the morse-panic patch features better
> punctuation handling, proper morse-like timings, and something like 1/5
> the static data requirement, thanks to the varicode algo that I
> couldn't come up with myself. :)
Indeed, that one had me scratching my head, even with the code in front of
me. Let me describe the encoding method for the benefit of anybody not
energetic or foolish enough to puzzle it out for themselves:
- The sequence is encoded from low bit to high, zero=dit, one=dah
- The sequence always terminates with a one=dah, which is dropped,
followed by an infinite string of zeros.
The infinite string of zeros is shifted in from the top of the byte, hence
the terminating condition morse <= 1, which prudently covers the impossible
case of morse == 0.
This deserves a comment.
Note that there is a bug waiting to bite: you need to declare morse as
unsigned char, otherwise you will be unable to make good on your claim that
up to 7 morse bits can be encoded.
-- Daniel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/