Click here to Skip to main content
15,896,201 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Maths Pin
Paul Conrad2-May-07 11:05
professionalPaul Conrad2-May-07 11:05 
AnswerRe: Maths Pin
cp98761-May-07 20:42
cp98761-May-07 20:42 
QuestionSpherical Math Book ? Pin
James D Davis30-Apr-07 14:36
James D Davis30-Apr-07 14:36 
AnswerRe: Spherical Math Book ? Pin
ricecake2-May-07 3:35
ricecake2-May-07 3:35 
GeneralRe: Continuity and the Future of Mathematics Pin
Rilhas24-May-07 12:05
Rilhas24-May-07 12:05 
GeneralRe: Continuity and the Future of Mathematics Pin
Rilhas25-May-07 1:20
Rilhas25-May-07 1:20 
QuestionCircular shifting Pin
CarpenterJim28-Apr-07 9:39
CarpenterJim28-Apr-07 9:39 
AnswerRe: Circular shifting Pin
Luc Pattyn28-Apr-07 10:33
sitebuilderLuc Pattyn28-Apr-07 10:33 
Hi,

AFAIK there is no such function available in the standard libraries.
The operation should be called rotation.
A buffer that gets used from 0 till dim-1 then back to 0 etc is called a circular
buffer.
Are you sure you need to move the data around, a circular buffer is used for
many purposes (e.g. between a producer and a consumer, using a put and a get pointer);
circular buffers may be optimized by using a dimension that equals a power of two
(so you dont need to test for wrapping around, you simply mask away the overflowing
bit).

If you must move the data over an arbitrary shift amount, you could use an existing
copy function twice:
-once for the part that moves to the right, and once for the part that moves to
the left; since source and destination overlap, you would need a temp buffer for
one of the moves.
Moving over only one position only needs one memcpy or similar, and one temp variable.

Smile | :)

Luc Pattyn

[My Articles]

GeneralRe: Circular shifting Pin
Stephen Hewitt29-Apr-07 15:04
Stephen Hewitt29-Apr-07 15:04 
AnswerRe: Circular shifting Pin
Arun.Immanuel28-Apr-07 16:01
Arun.Immanuel28-Apr-07 16:01 
AnswerRe: Circular shifting Pin
Stephen Hewitt29-Apr-07 14:59
Stephen Hewitt29-Apr-07 14:59 
GeneralRe: Circular shifting Pin
CarpenterJim30-Apr-07 15:12
CarpenterJim30-Apr-07 15:12 
GeneralRe: Circular shifting Pin
Stephen Hewitt30-Apr-07 15:16
Stephen Hewitt30-Apr-07 15:16 
GeneralRe: Circular shifting Pin
CarpenterJim30-Apr-07 15:24
CarpenterJim30-Apr-07 15:24 
GeneralRe: Circular shifting Pin
Nathan Addy2-May-07 8:48
Nathan Addy2-May-07 8:48 
JokeStar Wars Pin
Joeinorange227-Apr-07 13:26
Joeinorange227-Apr-07 13:26 
QuestionGolden Ratio Pin
Joeinorange227-Apr-07 13:22
Joeinorange227-Apr-07 13:22 
AnswerRe: Golden Ratio Pin
Paul Conrad14-Jul-07 10:18
professionalPaul Conrad14-Jul-07 10:18 
QuestionRandom Numbers: Is there anything really random? Pin
Bulky Fellow27-Apr-07 0:13
Bulky Fellow27-Apr-07 0:13 
AnswerRe: Random Numbers: Is there anything really random? Pin
cp987627-Apr-07 2:08
cp987627-Apr-07 2:08 
AnswerRe: Random Numbers: Is there anything really random? Pin
Nathan Addy27-Apr-07 10:58
Nathan Addy27-Apr-07 10:58 
GeneralRe: Random Numbers: Is there anything really random? Pin
cp987627-Apr-07 15:55
cp987627-Apr-07 15:55 
GeneralRe: Random Numbers: Is there anything really random? Pin
Stephen Hewitt29-Apr-07 18:10
Stephen Hewitt29-Apr-07 18:10 
GeneralRe: Random Numbers: Is there anything really random? Pin
Bulky Fellow29-Apr-07 23:26
Bulky Fellow29-Apr-07 23:26 
GeneralRe: Random Numbers: Is there anything really random? Pin
cp987630-Apr-07 0:54
cp987630-Apr-07 0:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.