自定义字节大小? [英] Custom byte size?
问题描述
所以,你知道char类型的原语的大小是1字节吗?我如何使自定义大小的原始?所以喜欢而不是一个int的大小为4字节我使一个大小的让我说16.
有没有办法做到这一点?有没有办法?
So, you know how the primitive of type char has the size of 1 byte? How would I make a primitive with a custom size? So like instead of an in int with the size of 4 bytes I make one with size of lets say 16. Is there a way to do this? Is there a way around it?
推荐答案
通常你只需要创建一个表示你感兴趣的数据的结构。如果它是16个字节的数据,它是一些较小类型的聚合,或者你正在使用一个本地的16字节整数类型的处理器。
Normally you'd just make a struct that represents the data in which you're interested. If it's 16 bytes of data, either it's an aggregate of a number of smaller types or you're working on a processor that has a native 16-byte integral type.
如果您想要表示非常大的数字,您可能需要找到一个处理任意大小的数字的特殊库。
If you're trying to represent extremely large numbers, you may need to find a special library that handles arbitrarily-sized numbers.
这篇关于自定义字节大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!