Boost logo

Boost :

Subject: Re: [boost] [GSoC]Bits and Ints
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-04-10 15:31:55


On Thu, 8 Apr 2010, Andrew Sutton wrote:

>> Is there any other existing integral special functions that mentioned
>> in the second part? Where can I find them?
>>
>
> I'm not aware of any. Maybe Jeremiah can provide some additional references?

Most of the stuff is from the URL that is on the Wiki page; a lot of the
stuff is fairly basic but part of the goal is to abstract special
processor instructions that do the operations with the best performance
(rotate instructions, conditional moves based on the carry bit, etc.).
That covers items 1 and 7 from the second bulleted list under Bits & Ints.
Sign extension and saturating arithmetic may also have special
instructions, as might bit-reversed addition and similar operations, but
portable versions would also be necessary for platforms that don't have
special instructions. Some more references are:

Chapter 8 of
http://support.amd.com/us/Processor_TechDocs/40546-PUB-Optguide_3-11_5-21-09.pdf
(for integer division by a repeated value)

http://graphics.stanford.edu/~seander/bithacks.html (we probably should
have everything in here)

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.86.1801 (with the
addition routines for interleaved integers using arbitrary masks)

A couple of new things to add to the list: generic versions of
count-leading-zeros, count-trailing-zeros, population count, etc. that
have gcc intrinsics (only for certain concrete types, and with different
names for different types) and often special instructions.

-- Jeremiah Willcock


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk