您现在的位置是:首页
>
c语言函数封装 XSL中几个封装的函数
XSL中几个封装的函数 布尔操作函数 lt ! ======================================================== gt lt ! Fu ctio : B
XSL中几个封装的函数

布尔操作函数 <! ======================================================== > <! Function: BooleanOR(<value > <value >) => number > <! Parameters: > <! <value > the first number to be ORed > <! <value > the second number to be ORed > <! NB Only works with unsigned ints! > <xsl:template name= BooleanOR > <xsl:param name= value select= number( ) /> <xsl:param name= value select= number( ) /> <! recurse parameters > <xsl:param name= bitval select= number( ) /> <xsl:param name= accum select= number( ) /> <! calc bits present on values > <xsl:variable name= bit select= floor($value div $bitval) /> <xsl:variable name= bit select= floor($value div $bitval) /> <! do the OR on the bits > <xsl:variable name= thisbit > <xsl:choose> <xsl:when test= ($bit != ) or ($bit != ) ><xsl:value of select= $bitval /></xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:variable> <! if last recurse then output the value > <xsl:choose> <xsl:when test= $bitval = ><xsl:value of select= $accum + $thisbit /></xsl:when> <xsl:otherwise> <! recurse required > <xsl:call template name= BooleanOR > <xsl:with param name= value select= $value mod $bitval /> <xsl:with param name= value select= $value mod $bitval /> <xsl:with param name= bitval select= $bitval div /> <xsl:with param name= accum select= $accum + $thisbit /> </xsl:call template> </xsl:otherwise> </xsl:choose> </xsl:template> <! ======================================================== > <! Function: BooleanAND(<value > <value >) => number > <! Parameters: > <! <value > the first number to be ANDed > <! <value > the second number to be ANDed > <! NB Only works with unsigned ints! > <xsl:template name= BooleanAND > <xsl:param name= value select= number( ) /> <xsl:param name= value select= number( ) /> <! recurse parameters > <xsl:param name= bitval select= number( ) /> <xsl:param name= accum select= number( ) /> <! calc bits present on values > <xsl:variable name= bit select= floor($value div $bitval) /> <xsl:variable name= bit select= floor($value div $bitval) /> <! do the AND on the bits > <xsl:variable name= thisbit > <xsl:choose> <xsl:when test= ($bit != ) and ($bit != ) ><xsl:value of select= $bitval /></xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:variable> <! if last recurse then output the value > <xsl:choose> <xsl:when test= $bitval = ><xsl:value of select= $accum + $thisbit /></xsl:when> <xsl:otherwise> <! recurse required > <xsl:call template name= BooleanAND > <xsl:with param name= value select= $value mod $bitval /> <xsl:with param name= value select= $value mod $bitval /> <xsl:with param name= bitval select= $bitval div /> <xsl:with param name= accum select= $accum + $thisbit /> </xsl:call template> </xsl:otherwise> </xsl:choose> </xsl:template> <! ======================================================== > <! Function: BooleanXOR(<value > <value >) => number > <! Parameters: > <! <value > the first number to be XORed > <! <value > the second number to be XORed > <! NB Only works with unsigned ints! > <xsl:template name= BooleanXOR > <xsl:param name= value select= number( ) /> <xsl:param name= value select= number( ) /> <! recurse parameters > <xsl:param name= bitval select= number( ) /> <xsl:param name= accum select= number( ) /> <! calc bits present on values > <xsl:variable name= bit select= floor($value div $bitval) /> <xsl:variable name= bit select= floor($value div $bitval) /> <! do the XOR on the bits > <xsl:variable name= thisbit > <xsl:choose> <xsl:when test= (($bit != ) and ($bit = )) or (($bit = ) and ($bit != )) ><xsl:value of select= $bitval /></xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:variable> <! if last recurse then output the value > <xsl:choose> <xsl:when test= $bitval = ><xsl:value of select= $accum + $thisbit /></xsl:when> <xsl:otherwise> <! recurse required > <xsl:call template name= BooleanXOR > <xsl:with param name= value select= $value mod $bitval /> <xsl:with param name= value select= $value mod $bitval /> <xsl:with param name= bitval select= $bitval div /> <xsl:with param name= accum select= $accum + $thisbit /> </xsl:call template> </xsl:otherwise> </xsl:choose> </xsl:template> lishixinzhi/Article/program/net/201311/13884
很赞哦! (1040)
相关文章
- 设函数fx在xa处可导 若函数f(x)=(a-2)x2+(a-1)x+3是偶函数,则函数f(x)的单调递减区间为______
- 设函数fx是定义在r上的偶函数 设f(x)为连续的偶函数,且当x>0时为单调函数,则满足f(x)=[(x+3)/(x+4)]的所有x的和为? 务必要有详尽的解
- c语言向函数传递数组指针 在C#中实现类似C++函数指针数组的功能
- c语言所有函数都是外部函数 在Java程序中调用Matlab函数
- c编程代码大全 C语言代码套用在Delphi编程中[1]
- 不同线程调用同一个函数 实例讲解.NET多线程执行函数
- c语言函数调用自己函数 hlook函数为什么不能调用后面200列的数据
- 析构函数与构造函数的区别 编写类String 的构造函数、析构函数和赋值函数
- c语言函数封装 封装free函数遇到的问题
- nc程式的编写 编写C程式,实现交换两个变数值的操作。要求: 编写C程式。使用形参为指标的函式swap完成交换功能。主函式
爱学记

微信收款码
支付宝收款码