Best way in D2 to rotate a ubyte[4] array

spir denis.spir at gmail.com
Wed Mar 9 16:00:20 PST 2011


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 ubyte...

This works for other arrays as well. dmd understands.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d-learn mailing list