本文整理汇总了C#中TypeDescriptor.GetFixFormat方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDescriptor.GetFixFormat方法的具体用法?C# TypeDescriptor.GetFixFormat怎么用?C# TypeDescriptor.GetFixFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDescriptor
的用法示例。
在下文中一共展示了TypeDescriptor.GetFixFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rewrite_Sin_ScSinCos_fixpt
private static IEnumerable<XILSInstr> Rewrite_Sin_ScSinCos_fixpt(TypeDescriptor joker, TypeDescriptor rtype, InstructionDependency[] preds)
{
var iset = DefaultInstructionSet.Instance;
var fmt = joker.GetFixFormat();
var rfmt = rtype.GetFixFormat();
int pifw = fmt.FracWidth;
var pitype = SFix.MakeType(0, pifw);
int muliw = fmt.IntWidth;
var multype = SFix.MakeType(muliw, fmt.FracWidth + pifw);
int fw = Math.Max(5, rfmt.FracWidth + 1); // Xilinx Cordic needs at least 8 input bits
fw = Math.Min(45, fw); // Xilinx Cordic likes at most 48 input bits
var cuttype = SFix.MakeType(3, fw);
var modtype = SFix.MakeType(3, fw); // Actually, 1 integer bit less is required. However, Xilinx Cordic needs the additional bit.
int fwr = Math.Max(6, rfmt.FracWidth); // Xilinx Cordic needs at least 8 output bits (?)
fwr = Math.Min(46, fwr); // Xilinx Cordic likes at most 48 output bits (?)
var sintype = SFix.MakeType(2, fwr);
if (muliw <= 1)
{
return new XILSInstr[]
{
iset.LdConst(SFix.FromDouble(1.0 / Math.PI, 0, pifw)).CreateStk(preds, 0, pitype),
iset.Mul().CreateStk(2, joker, pitype, multype),
iset.Convert().CreateStk(1, multype, modtype),
iset.ScSinCos().CreateStk(1, modtype, sintype, sintype),
iset.Swap().CreateStk(2, sintype, sintype, sintype, sintype),
iset.Pop().CreateStk(1, sintype)
};
}
else
{
return new XILSInstr[]
{
iset.LdConst(SFix.FromDouble(1.0 / Math.PI, 0, pifw)).CreateStk(preds, 0, pitype),
iset.Mul().CreateStk(2, joker, pitype, multype),
iset.Convert().CreateStk(1, multype, cuttype),
iset.Mod2().CreateStk(1, cuttype, modtype),
iset.ScSinCos().CreateStk(1, modtype, sintype, sintype),
iset.Swap().CreateStk(2, sintype, sintype, sintype, sintype),
iset.Pop().CreateStk(1, sintype)
};
}
}