Re: Software architecture using C for mid-range PIC.



Fevric J. Glandules wrote:
Hans-Bernhard Bröker wrote:
Fevric J. Glandules wrote:

The command set is fixed, and consists of about 30 ASCII triplets, and with any luck won't change too much.

Encoding a mere 30 commands as three-letter tokens is excessively redundant. I would strongly suggest to abbreviate further, to one or two letters. In the process you would both reduce your communication load and speed up the interpretation.

Meanwhile I've got a little less than 4K of RAM to play with <grin>.

You could still use a perfect hash function. That would basically amount to letting a machine condense your command set to single letters, in whichever way it liked.

Or you could combine all three letters into a single number, then switch() directly on that:

switch((u16)buf[0]<<16 + (u16)buf[1]<<8 + (u16)buf[2]<<0)

and let the compiler decide how to implement that most efficiently.
.



Relevant Pages

  • Re: Spell check does not catch single letters.
    ... Those letters are not in the lexicon. ... Word made this choice because there are many uses for single letters that ... >>>>>to get word to show a spelling error if only one ...
    (microsoft.public.word.spelling.grammar)
  • Re: YOU ALL SUCK!
    ... >> of generating text from the frequency of single letters, ... >> new character you look at the frequences of the letters given that the ... the same triples in the suspect text. ... one could generate a Markov Chain in the style of that author. ...
    (comp.os.linux.misc)
  • Re: where do so many tenses come from?
    ... Not only the frequency of phonemes plays a rôle but much more so the ... single letters (not the same as phonemes, but the effect will be the same ... 27 pairs beginning with that letter, and for one quadruple of letters ...
    (sci.lang)
  • Re: Alphacrypts
    ... > Came across an interesting little book yesterday - "Schott's Original ... > has least redundancy (excess letters). ... double and redundant, redundant? ... > needed to make a concise alphacrypt. ...
    (rec.puzzles)
  • Re: Andante boxed sets on offer
    ... MW appears to have caused the following letters to be ... interested in are redundant with things I already own. ... LSO Centenary set. ... do for my address what Androcles did for the lion ...
    (rec.music.classical.recordings)