Post Reply 
Request for Circular Shift Functions
07-20-2015, 01:00 AM
Post: #2
RE: Request for Circular Shift Functions
Hello Colm,

Is this what you mean?

For lists:
Code:

LOCAL s;

EXPORT listright(t)
BEGIN
 IF type(t)≠6 THEN RETURN ;END;
 s:=SIZE(t);
 RETURN CONCAT(t(s),SUB(t,1,s-1));
END;

EXPORT listleft(t)
BEGIN
 IF type(t)≠6 THEN RETURN ;END;
 s:=SIZE(t);
 RETURN CONCAT(SUB(t,2,s),t(1));
END;

For bits:
Code:

EXPORT bitleft(t)
BEGIN
 RETURN BITSL(t,1)+BITSR(t,GETBITS(t)-1);
END;

EXPORT bitright(t)
BEGIN
 RETURN BITSR(t,1)+BITSL(t,GETBITS(t)-1);
END;

Road
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Request for Circular Shift Functions - roadrunner - 07-20-2015 01:00 AM



User(s) browsing this thread: 1 Guest(s)