Re: ROL and ROR for RPN

Steve Shipway <[email protected]> Mon, 28 Apr 2014 09:27:28 +0000
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <5820DC553954E44FA1A36C78323AD1483A305E98@uxcn10-tdc06.UoA.auckland.ac.nz>
In that case, maybe just call it ROTATE.  This would give the maximum flexibility..

x1, x2 .... xn, n, steps, ROTATE
where
n > 0
0 < abs(steps) < n

I'm trying to think of an efficient way to do this that doesn't involve a malloc (it's easy if you can malloc(n*sizeof(double*)) ).  Will have a go when I'm in the office tomorrow.

However should we keep ROL and ROR as shorthand for the more common 3,1,ROTATE and 3,-1,ROTATE ?

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
[email protected]
Ph: +64 9 373 7599 ext 86487


________________________________________
From: Tobias Oetiker [[email protected]]
Sent: Monday, 28 April 2014 6:30 p.m.
To: Steve Shipway
Cc: [email protected]
Subject: Re: [rrd-developers] ROL and ROR for RPN

Hi Steve,

your function always affects 3 values ... would there be any gain
in makeing this call more generic ?

a,b,c,d,x,y,ROL rotate the last x values on the stack by y steps to
the left. and maybe have -y role to the right?

cheers
tobi