From: Andrew Rodland <arodland@noln.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] morse code panics for 2.5.62
Date: Tue, 18 Feb 2003 11:00:23 -0500 [thread overview]
Message-ID: <b2tl9c$48c$1@main.gmane.org> (raw)
In-Reply-To: 20030218141757.GV351@lug-owl.de
<posted & mailed>
Jan-Benedict Glaw wrote:
> On Tue, 2003-02-18 14:50:38 +0100, Tomas Szepe <szepe@pinerecords.com>
> wrote in message <20030218135038.GA1048@louise.pinerecords.com>:
>
> This is the first time I really look at the code, so please forgive if I
> talk about things where already a consens was given...
>> +const unsigned char morsetable[] = {
>> + 0122, 0, 0310, 0, 0, 0163, /* "#$%&' */
>> + 055, 0155, 0, 0, 0163, 0141, 0152, 0051, /* ()*+,-./ */
>> + 077, 076, 074, 070, 060, 040, 041, 043, 047, 057, /* 0-9 */
>> + 0107, 0125, 0, 0061, 0, 0114, 0, /* :;<=>?@ */
>> + 006, 021, 025, 011, 002, 024, 013, 020, 004, /* A-I */
>> + 036, 015, 022, 007, 005, 017, 026, 033, 012, /* J-R */
>> + 010, 003, 014, 030, 016, 031, 035, 023, /* S-Z */
>> + 0, 0, 0, 0, 0154 /* [\]^_ */
>> +};
>
> You're using a set bit for long and an unset bit for a short beep, don't
> you? Storing these values in octal/as chars is quite low on memory
> consumption, but I'd like to learn so I suggest:
It's slightly more complicated than that:
It's set bits for long, unset bits for short, and termination when the byte
equals 0x01 (in other words, there's an extra set bit to the left of what
we want). This lets us represent any variable-length morse of up to 7
dits/dahs with a byte, which is cool because nothing is more than 6, that
I've ever seen.
The use of macros is an OK hack though, it reminds me of the nethack source.
:)
The reason someone proposed this in the first place is because I had had
const unsigned char * morsetable [] = {
".-..-.", NULL, "...-..-"
and so on in the initial revision of my patch, which is quite readable, but
takes up a lot more space, and makes the code actually a bit messier too.
--Andrew
next prev parent reply other threads:[~2003-02-18 15:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-18 13:50 [PATCH] morse code panics for 2.5.62 Tomas Szepe
2003-02-18 14:17 ` Jan-Benedict Glaw
2003-02-18 16:00 ` Andrew Rodland [this message]
2003-02-18 17:12 ` Jan-Benedict Glaw
2003-02-18 22:49 ` Tomas Szepe
2003-02-19 9:07 ` Jan-Benedict Glaw
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='b2tl9c$48c$1@main.gmane.org' \
--to=arodland@noln.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox