internal void SortObject(long left, long right) { object obj3; if (right <= left) { return; } long num = left + ((long)((right - left) * MathObject.random())); LateBinding.SwapValues(this.obj, (uint)num, (uint)right); object valueAtIndex = LateBinding.GetValueAtIndex(this.obj, (ulong)right); long num2 = left - 1L; long num3 = right; Label_0039: obj3 = LateBinding.GetValueAtIndex(this.obj, (ulong)(num2 += 1L)); if ((num2 < num3) && (this.Compare(valueAtIndex, obj3) >= 0)) { goto Label_0039; } do { obj3 = LateBinding.GetValueAtIndex(this.obj, (ulong)(num3 -= 1L)); }while ((num3 > num2) && (this.Compare(valueAtIndex, obj3) <= 0)); if (num2 < num3) { LateBinding.SwapValues(this.obj, (uint)num2, (uint)num3); goto Label_0039; } LateBinding.SwapValues(this.obj, (uint)num2, (uint)right); this.SortObject(left, num2 - 1L); this.SortObject(num2 + 1L, right); }
internal void SortObject(long left, long right) //left and right are longs to allow for values < 0. Their positives values are always < UInt32.MaxValue. { Object x, y; if (right > left) { long piv = left + (long)((right - left) * MathObject.random()); LateBinding.SwapValues(this.obj, (uint)piv, (uint)right); x = LateBinding.GetValueAtIndex(this.obj, (ulong)right); long i = left - 1, j = right; while (true) { do { y = LateBinding.GetValueAtIndex(this.obj, (ulong)++i); }while(i < j && this.Compare(x, y) >= 0); do { y = LateBinding.GetValueAtIndex(this.obj, (ulong)--j); }while(j > i && this.Compare(x, y) <= 0); if (i >= j) { break; } LateBinding.SwapValues(this.obj, (uint)i, (uint)j); } LateBinding.SwapValues(this.obj, (uint)i, (uint)right); this.SortObject(left, i - 1); this.SortObject(i + 1, right); } }
public static Object reverse(Object thisob) { uint thisLength = Convert.ToUint32(LateBinding.GetMemberValue(thisob, "length")); uint halfSize = thisLength / 2; for (uint low = 0, high = thisLength - 1; low < halfSize; low++, high--) { LateBinding.SwapValues(thisob, low, high); } return(thisob); }
public static object reverse(object thisob) { uint num = Microsoft.JScript.Convert.ToUint32(LateBinding.GetMemberValue(thisob, "length")); uint num2 = num / 2; uint left = 0; for (uint i = num - 1; left < num2; i--) { LateBinding.SwapValues(thisob, left, i); left++; } return(thisob); }