Beispiel #1
0
        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject targetProject)
        {
            if (instr.Name != InstructionCodes.Sign)
            {
                return(null);
            }

            int floatWidth;

            if (operandTypes[0].CILType.Equals(typeof(float)))
            {
                floatWidth = 32;
            }
            else if (operandTypes[0].CILType.Equals(typeof(double)))
            {
                floatWidth = 64;
            }
            else if (operandTypes[0].CILType.Equals(typeof(Signed)) ||
                     operandTypes[0].CILType.Equals(typeof(SFix)))
            {
                floatWidth = operandTypes[0].GetFixFormat().TotalWidth;
            }
            else
            {
                return(null);
            }

            var fmt = resultTypes[0].GetFixFormat();

            if (fmt == null || !fmt.IsSigned || fmt.IntWidth < 2)
            {
                return(null);
            }

            var fsas = new FloatSignAsSigned(floatWidth, fmt);

            return(new Mapping(fsas));
        }
Beispiel #2
0
 public TransactionSite(FloatSignAsSigned host) :
     base(host)
 {
     _host = host;
 }
Beispiel #3
0
 public Mapping(FloatSignAsSigned host)
 {
     _host = host;
 }
 public TransactionSite(FloatSignAsSigned host) :
     base(host)
 {
     _host = host;
 }
        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject targetProject)
        {
            if (instr.Name != InstructionCodes.Sign)
                return null;

            int floatWidth;
            if (operandTypes[0].CILType.Equals(typeof(float)))
                floatWidth = 32;
            else if (operandTypes[0].CILType.Equals(typeof(double)))
                floatWidth = 64;
            else if (operandTypes[0].CILType.Equals(typeof(Signed)) ||
                operandTypes[0].CILType.Equals(typeof(SFix)))
                floatWidth = operandTypes[0].GetFixFormat().TotalWidth;
            else
                return null;

            var fmt = resultTypes[0].GetFixFormat();
            if (fmt == null || !fmt.IsSigned || fmt.IntWidth < 2)
                return null;

            var fsas = new FloatSignAsSigned(floatWidth, fmt);
            return new Mapping(fsas);
        }
 public Mapping(FloatSignAsSigned host)
 {
     _host = host;
 }