再present只用10000位10000布尔布尔、present

2023-09-12 21:22:42 作者:此男子不存在

我要重新present 10000位信息。(每个人都可以是一个或零)。有没有什么办法可以做到这一点?

I want to represent 10000 bits of information.(Each can be either one or zero). Is there any way I can do this?

维基百科的解释有点本事以实现这一目标。但随后问我有一个数字,就是大到2 ^ 10000存储10000位。

Wikipedia explains a bit hack to achieve this. But then it asks me to have a number that's as large as 2^10000 for storing 10000 bits.

是否有某种方式,就是听话,甚至用于存储大量的位?

Is there some way that's tractable even for storing large number of bits?

推荐答案

随着维基百科的解释,有些字段是这里一个合适的选择。位域可容纳10000位有2 ^ 10000状态。

As wikipedia explains, a bit field is an appropriate choice here. a bit field that can hold 10,000 bits has 2^10000 states.

这样做的一个很好的选择(因为整数是32/64位)是位向量,这是询问和痛苦这里详细解释:

A good choice for doing this (given that integers are 32/64 bits) is a bit vector, which is asked about and explained in excruciating detail here:

bit在编程珠玑向量执行组,第2版

总的想法是,你使用整数被用作位字段的数组。

The general idea is that you use an array of integers which are used as bit fields.