wasSharp – Diff between revs 7 and 27
?pathlinks?
Rev 7 | Rev 27 | |||
---|---|---|---|---|
Line 20... | Line 20... | |||
20 | /// <param name="index">a positive or negative index of the element</param> |
20 | /// <param name="index">a positive or negative index of the element</param> |
|
21 | /// <param name="data">the array</param> |
21 | /// <param name="data">the array</param> |
|
22 | /// <return>an array element</return> |
22 | /// <return>an array element</return> |
|
23 | public static T GetElementAt<T>(T[] data, int index) |
23 | public static T GetElementAt<T>(T[] data, int index) |
|
24 | { |
24 | { |
|
25 | return index < 0 ? data[(index%data.Length + data.Length)%data.Length] : data[index%data.Length]; |
25 | return index < 0 ? data[(index % data.Length + data.Length) % data.Length] : data[index % data.Length]; |
|
26 | } |
26 | } |
|
Line 27... | Line 27... | |||
27 | |
27 | |
|
28 | /////////////////////////////////////////////////////////////////////////// |
28 | /////////////////////////////////////////////////////////////////////////// |
|
29 | // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
29 | // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
|
Line 128... | Line 128... | |||
128 | Array.Copy(input, input.Length - 1, slice, 0, 1); |
128 | Array.Copy(input, input.Length - 1, slice, 0, 1); |
|
129 | Array.Copy(input, 0, slice, 1, input.Length - 1); |
129 | Array.Copy(input, 0, slice, 1, input.Length - 1); |
|
130 | return ForwardPermuteArrayElements(slice, --times); |
130 | return ForwardPermuteArrayElements(slice, --times); |
|
131 | } |
131 | } |
|
132 | } |
132 | } |
|
133 | } |
- | ||
134 | |
133 | } |
|
- | 134 | |