コード例 #1
0
ファイル: ArrayObject.cs プロジェクト: RainsSoft/IronJS
            public static SparseArray OfDense(Descriptor[] values)
            {
                var sparse = new SparseArray();

                for (int i = 0; i < values.Length; i++)
                {
                    if (values[i].HasValue)
                    {
                        uint num = (uint)i;
                        sparse.storage[num] = values[i].Value;
                    }
                }

                return sparse;
            }
コード例 #2
0
ファイル: ArrayObject.cs プロジェクト: RainsSoft/IronJS
        private void ResizeDense(uint newCapacity)
        {
            var capacity = (uint)this.dense.Length;
            newCapacity = newCapacity == 0 ? 2 : newCapacity;

            var copyLength = newCapacity < capacity ? newCapacity : capacity;

            var newDense = new Descriptor[newCapacity];
            Array.Copy(this.dense, newDense, copyLength);
            this.dense = newDense;
        }