未签名的二进制分区 [英] Unsigned Binary Division

查看:109
本文介绍了未签名的二进制分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望代码c#用于无符号二进制除法,如果有人知道的话
我需要重要的东西thnx

hi , i want code c# for unsigned binary division pls if any body know
i need it important thnx

推荐答案

尝试
public static void DivMod (Int128 dividend, Int128 divisor, out Int128 quotient, out Int128 remainder)
{
    quotient = dividend;
    remainder = 0;
    for (int i = 0; i < 128; i++)
    {
        // Left shift Remainder:Quotient by 1
        remainder <<= 1;
        if (quotient < 0)
            remainder._lo |= 1;
        quotient <<= 1;

        if (remainder >= divisor)
        {
            remainder -= divisor;
            quotient++;
        }
    }
}



参考链接:-二进制分区 [二进制划分算法 [



Reference Link :- Binary Division[^]
Must see
Binary Devision Algorithm[^]


这篇关于未签名的二进制分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆