Exemple #1
0
        public void SetUInt32(long index, EcmaValue value, DataViewEndianness isLittleEndian)
        {
            Guard.BufferNotDetached(this);
            uint uintValue = value.ToUInt32();

            ThrowIfOutOfBound(index, sizeof(uint));
            this.Buffer.SetValue(index + ByteOffset, CheckAndSwap(uintValue, isLittleEndian));
        }
Exemple #2
0
        public static EcmaValue Imul(EcmaValue x, EcmaValue y)
        {
            uint a      = x.ToUInt32();
            uint b      = y.ToUInt32();
            uint ah     = (a >> 16) & 0xffff;
            uint al     = a & 0xffff;
            uint bh     = (b >> 16) & 0xffff;
            uint bl     = b & 0xffff;
            uint result = (al * bl) + ((ah * bl + al * bh) << 16);

            return((int)result);
        }
Exemple #3
0
        public static EcmaValue Clz32(EcmaValue value)
        {
            uint x = value.ToUInt32();

            return(x == 0 ? 32 : 31 - (int)Math.Floor(Math.Log(x) * LOG2E));
        }