为什么要使用更高基地实施BigInt有? [英] Why to use higher base for implementing BigInt?

查看:183
本文介绍了为什么要使用更高基地实施BigInt有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现BigInt有,并已阅读了有关它的一些主题和文章,大多建议使用较高基地(256或2 ^ 32甚至2 ^ 64)。

I'm trying to implement BigInt and have read some threads and articles regarding it, most of them suggested to use higher bases(256 or 2^32 or even 2^64).

为什么高基地有利于这一目的?

其他的问题我已经是我怎么将一个字符串转换为基数较高(> 16)。我看是没有标准的方法,除了BASE64。最后一个问题,我怎么使用这些高基地。一些例子将是巨大的。

Other question I have is how am I supposed to convert a string into higher base(>16). I read there is no standard way, except for base64. And the last question, how do I use those higher bases. Some examples would be great.

推荐答案

的CPU周期花费乘以或加入了一些适合在寄存器往往是相同的。所以,你会拿得最少的迭代次数,和最佳的性能,使用了整个寄存器。也就是说,在32位架构,让你的基本单元32位,在64位架构,使64位。否则 - 也就是说,如果你只填写8位的32位寄存器的 - 你是在浪费周期

The CPU cycles spent multiplying or adding a number that fits in a register tend to be identical. So you will get the least number of iterations, and best performance, by using up the whole register. That is, on a 32-bit architecture, make your base unit 32 bits, and on a 64-bit architecture, make it 64 bits. Otherwise--say, if you only fill up 8 bits of your 32 bit register--you are wasting cycles.

这篇关于为什么要使用更高基地实施BigInt有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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