What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
TIA,
Tom;
Tom:
What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
Two versions, I have done no benchmarks so far:
import std.c.stdio: printf;
union Four {
ubyte[4] a;
uint u;
}
void showFour(Four f) {
On 03/09/2011 03:41 PM, Tom wrote:
What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
TIA,
Tom;
I don't know of anything more efficient than:
ubyte[4] bytes = [1,2,3,4];
bytes = bytes[$-1] ~
On Wednesday, March 09, 2011 15:35:29 Kai Meyer wrote:
On 03/09/2011 03:41 PM, Tom wrote:
What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
TIA,
Tom;
I don't know of anything more efficient than:
On 03/09/2011 04:25 PM, bearophile wrote:
Tom:
What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
Two versions, I have done no benchmarks so far:
import std.c.stdio: printf;
union Four {
ubyte[4] a;
On 03/10/2011 12:55 AM, Jonathan M Davis wrote:
I don't know of anything more efficient than:
ubyte[4] bytes = [1,2,3,4];
bytes = bytes[$-1] ~ bytes[0..$-1]; // Rotate left
I'm stunned that this works. I'd even consider reporting it as a bug. You're
concatenating a ubyte[] ont a
== Quote from bearophile (bearophileh...@lycos.com)'s article
Tom:
What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
Two versions, I have done no benchmarks so far:
import std.c.stdio: printf;
union Four
On Wed, Mar 9, 2011 at 7:25 PM, U2 fan i...@u2fan.com wrote:
== Quote from bearophile (bearophileh...@lycos.com)'s article
Tom:
What is the most efficient way of implement a rotation of ubyte[4] array?
By rotation I mean: rotateRight([1, 2, 3, 4]) - [4, 1, 2, 3]
Two versions, I have done