简体   繁体   English

Float32和UInt32?

[英]Float32 and UInt32?

I am looking at some older Apple code for C++, I am familiar with float but not Float32 and Uint32 types are they the same as standard float and ints? 我正在寻找一些旧的Apple C ++代码,我熟悉浮点数而不是Float32和Uint32类型它们是否与标准浮点数和整数相同?

Thanks 谢谢

UInt32 is a 32-bit (4-byte) unsigned integer. UInt32是一个32位(4字节)无符号整数。 This means that it can represent values in the range 这意味着它可以表示范围内的值
[0, 2^32-1] ( = [0, 4294967295] ). [0, 2^32-1]= [0, 4294967295] )。

Float32 is a 32-bit (aka single-precision [contrast with double-precision] ) floating point number . Float32是一个32位(又名单精度 [ 双精度对比度]浮点数


As other answers have mentioned, the types exist to guarantee the width. 正如其他答案所提到的,存在类型以保证宽度。

The suffix gives the bit size. 后缀给出了位大小。 This makes them the same if and only if the Standard float and int have the same size on the target machine. 当且仅当标准float和int在目标机器上具有相同的大小时,这使它们相同。 They exist to give guaranteed sizes on all platforms. 它们的存在是为了在所有平台上保证尺寸。

I suppose they are some typedef respectively for a floating point type and an unsigned integer type guaranteed to be 32 bit wide . 我认为它们分别是浮点类型和无符号整数类型的一些typedef保证是32位宽

On most platforms they will simply decay to float (at least, on any machine that uses the IEEE 754 standard) and, on 32 bit machines, to unsigned int (on some 64 bit platforms it may decay to unsigned short ). 在大多数平台上,它们将简单地衰减float (至少在任何使用IEEE 754标准的机器上),并且在32位机器上衰减到unsigned short unsigned int (在某些64位平台上它可能衰减到unsigned short )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM