Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

RE: [AVR-Chat] Re: Challenge - count bits set in byte

RE: [AVR-Chat] Re: Challenge - count bits set in byte

2005-06-10 by Paul Curtis

All,

> Mid point is to use smaller table & index it with the upper & 
> lower nibble. Accessing the appropriate nibble still carries 
> its own overhead so generally all of these get down to the 
> usual speed/flash usage issues which makes it handy to go to 
> CPU overkill for anything other than consumer products which 
> are to be manufactured by the gazillion.
> 
> A suggestion - I agree wholeheartedly with the proposal to 
> try to draw out all of the battle won integer algorithms 
> hiding in peoples heads. It would be useful to toss a brief 
> desc in the subject to make it easy to follow the discussion 
> much later on when going back to explore the proposal. The 
> discussion & alternate solutions can be as important as the 
> eventual winner.

Try "Hacker's Delight".

http://www.hackersdelight.org/

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

Re: [AVR-Chat] Hacker's Delight

2005-06-11 by Don Ingram

> Try "Hacker's Delight".
 >
 > http://www.hackersdelight.org/
 >

Thanks for the head-up on this Paul. It's in stock at Amazon ( well 
there's one less in stock now ;-)

Cheers

Don

Paul Curtis wrote:
Show quoted textHide quoted text
> All,
> 
> 
>>Mid point is to use smaller table & index it with the upper & 
>>lower nibble. Accessing the appropriate nibble still carries 
>>its own overhead so generally all of these get down to the 
>>usual speed/flash usage issues which makes it handy to go to 
>>CPU overkill for anything other than consumer products which 
>>are to be manufactured by the gazillion.
>>
>>A suggestion - I agree wholeheartedly with the proposal to 
>>try to draw out all of the battle won integer algorithms 
>>hiding in peoples heads. It would be useful to toss a brief 
>>desc in the subject to make it easy to follow the discussion 
>>much later on when going back to explore the proposal. The 
>>discussion & alternate solutions can be as important as the 
>>eventual winner.
> 
> 
> Try "Hacker's Delight".
> 
> http://www.hackersdelight.org/
> 
> --
> Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
>

Embedding binary data in C code

2005-06-11 by Don Ingram

Hi All,

Stumbled across this very simple but nonetheless neat tool when I should 
have been working ;-)

File lives at http://www.azillionmonkeys.com/qed/metac.zip

It allows you to create arrays of binary or text data in a C source file.

The tool looks for a tag in the source and then inserts the external 
file data from that point.

Useful for tables of constants or for regionalising display strings.

Just call metac on a .c file & pipe the output to a new file, the name 
of the file to be inserted is in the source file.

The output from metac.exe /? is shown below.

-- 
Cheers

Don




METAC: A program for inlining binary data into C
written by Paul Hsieh

         Metac will take a C-like file, simply output the file's
         contents to standard out until it reads an inline file
         token.  Such tokens appear with the syntax:

             @filename

         So, for example, if you wanted to include a string that you
         have authored as an ordinary text file into your C code you
         could simply write:

             char Msg1[] = {@readme.txt};

         then filtering through metac, the @readme.txt contents are
         injected inline between the quotes as standard C syntax
         chars, replacing the occurrence of @readme.txt.

         The idea was inspired by Window's resources which were in
         turn inspired by people who would arbitrarily tack data on
         the ends of their executables.  Clearly this idea is more
         general and easier on the programmer.  But it has the
         disadvantage or necessarily including the inlined data in
         memory during execution.

         KNOWN BUGS:

         Intrudes on otherwise legal uses of the @ symbol.

Re: [AVR-Chat] Hacker's Delight

2005-06-24 by Don

The book turned up today from the States.

http://www.amazon.com/exec/obidos/tg/detail/-/0201914654/103-4320452-0332615?v=glance

In the brief read which I have had so far I am quite impressed. The info 
seems very well presented, being Addison-Wesley based it is of what 
appears to be a high standard.

More than can be said for a lot of the rest written about computing. 
They should be written on softer paper as then they would at least be 
useful for one thing...

Cheers ;-)

Don



Don Ingram wrote:
Show quoted textHide quoted text
>  > Try "Hacker's Delight".
>  >
>  > http://www.hackersdelight.org/
>  >
> 
> Thanks for the head-up on this Paul. It's in stock at Amazon ( well 
> there's one less in stock now ;-)
> 
> Cheers
> 
> Don
> 
> Paul Curtis wrote:
> 
>>All,
>>
>>
>>
>>>Mid point is to use smaller table & index it with the upper & 
>>>lower nibble. Accessing the appropriate nibble still carries 
>>>its own overhead so generally all of these get down to the 
>>>usual speed/flash usage issues which makes it handy to go to 
>>>CPU overkill for anything other than consumer products which 
>>>are to be manufactured by the gazillion.
>>>
>>>A suggestion - I agree wholeheartedly with the proposal to 
>>>try to draw out all of the battle won integer algorithms 
>>>hiding in peoples heads. It would be useful to toss a brief 
>>>desc in the subject to make it easy to follow the discussion 
>>>much later on when going back to explore the proposal. The 
>>>discussion & alternate solutions can be as important as the 
>>>eventual winner.
>>
>>
>>Try "Hacker's Delight".
>>
>>http://www.hackersdelight.org/
>>
>>--
>>Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
>>CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
>>

Re: [AVR-Chat] Hacker's Delight

2005-06-24 by Dave VanHorn

At 11:08 PM 6/23/2005, Don wrote:
>The book turned up today from the States.
>
>http://www.amazon.com/exec/obidos/tg/detail/-/0201914654/103-4320452-0332615?v=glance
>
>In the brief read which I have had so far I am quite impressed. The info
>seems very well presented, being Addison-Wesley based it is of what
>appears to be a high standard.

I'd second that. I got my copy last week, but I've been too busy to 
do more than skim it.
Hopefully, I'll get back to abnormal soon, and I'll have time to look 
through it better.

The exchange two registers trick is in there.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.