lkml.org 
[lkml]   [2002]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -ac] Panicking in morse code
On Fri, 19 Jul 2002, Alan Cox wrote:

> > +static const char * morse[] = {
> > + ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", /* A-H */
> > + "..", ".---.", "-.-", ".-..", "--", "-.", "---", ".--.", /* I-P */
> > + "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", /* Q-X */
> > + "-.--", "--..", /* Y-Z */
> > + "-----", ".----", "..---", "...--", "....-", /* 0-4 */
> > + ".....", "-....", "--...", "---..", "----." /* 5-9 */
>
> How about using bitmasks here. Say top five bits being the length, lower
> 5 bits being 1 for dash 0 for dit ?

??? If the length is 1..5 I suspect you could use the top two bits and fit
the whole thing in a byte. But since bytes work well, use the top three
bits for length without the one bit offset. Still a big win over strings,
although a LOT harder to get right by eye.

I want to see this go to the sound card, so that when the admins are in
the ready room drinking coffee and listening to mp3s over the speakers
they will "get the message." Actually one guys says he can read morse in
his sleep, when he's "studying a manual" head down we might see about
that;-)

--
bill davidsen <davidsen@tmr.com>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.154 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site