Microsoft.Scripting.Utils.MathUtils.GetWords C# (CSharp) Method

GetWords() private method

private GetWords ( this self ) : uint[]
self this
return uint[]
        public static uint[] GetWords(this BigInt self) {
            if (self.IsZero) {
                return new uint[] { 0 };
            }

            int hi;
            byte[] bytes;
            GetHighestByte(self, out hi, out bytes);

            uint[] result = new uint[(hi + 1 + 3) / 4];
            int i = 0;
            int j = 0;
            uint u = 0;
            int shift = 0;
            while (i < bytes.Length) {
                u |= (uint)bytes[i++] << shift;
                if (i % 4 == 0) {
                    result[j++] = u;
                    u = 0;
                }
                shift += 8;
            }
            if (u != 0) {
                result[j] = u;
            }
            return result;
        }