Example #1
0
        public AcpiData ShiftLeft(int bits)
        {
            if (this.Type != AcpiDataType.Int)
            {
                return(null);
            }
            AcpiData data = new AcpiData();

            data.Assign(this);
            data.Value = data.Value << bits;
            return(data);
        }
Example #2
0
        public AcpiData Op(AcpiData amlData, string OpName)
        {
            AcpiData data = new AcpiData();

            if (OpName == "Not")
            {
                data.Assign(this);
                data.Value = ~amlData.Value;
                return(data);
            }
            if (this.Type != amlData.Type)
            {
                return(null);
            }
            if (this.Type == AcpiDataType.Int)
            {
                data.Assign(this);

                if (OpName == "Or")
                {
                    data.Value = amlData.Value | data.Value;
                }
                else if (OpName == "And")
                {
                    data.Value = amlData.Value & data.Value;
                }
                else if (OpName == "NAnd")
                {
                    data.Value = ~(amlData.Value & data.Value);
                }
                else if (OpName == "XOr")
                {
                    data.Value = amlData.Value ^ data.Value;
                }
            }
            return(data);
        }
Example #3
0
        public AcpiData ToString(int Length)
        {
            if (this.Type != AcpiDataType.Buffer)
            {
                return(null);
            }
            if (Length > this.bpValue.Length)
            {
                return(null);
            }
            AcpiData data = new AcpiData();

            data.Assign(this);
            data.Type     = AcpiDataType.String;
            data.strValue = BitConverter.ToString(data.bpValue, 0, Length);
            return(data);
        }
Example #4
0
        public AcpiData Concat(AcpiData amlData)
        {
            AcpiData data = new AcpiData();

            if (this.Type != amlData.Type)
            {
                return(null);
            }
            if (this.Type == AcpiDataType.Buffer)
            {
                data.Assign(this);
                //data.Value = amlData.Value & data.Value;
                byte[] bytes = new byte[data.bpValue.Length + amlData.bpValue.Length];
                data.bpValue.CopyTo(bytes, 0);
                amlData.bpValue.CopyTo(bytes, data.bpValue.Length);
                data.bpValue = bytes;
            }
            return(data);
        }