为什么的Int32最大值是0x7FFFFFFF的? [英] Why Int32 maximum value is 0x7FFFFFFF?

查看:1120
本文介绍了为什么的Int32最大值是0x7FFFFFFF的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MSDN文档看到的Int32 2,147,483,647 ,十六进制的最大值。为0x7FFFFFFF 结果
的http:// msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx

I saw in MSDN documents that the maximum value of Int32 is 2,147,483,647, hexadecimal 0x7FFFFFFF.
http://msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx

我想,如果是的Int32 它应该门店32位整数值,它最终应 4,294,967,295 和十六进制 0xFFFFFFFF的

I think, if it's Int32 it should stores 32 bits integer value that finally should be 4,294,967,295 and hexadecimal 0xFFFFFFFF.

我的问题是,为什么的Int32 商店 31 位整数?

My question is why Int32 stores 31 bits integer value?

推荐答案

这是一个有符号整数,最高位(最高有效位)通常结束为标志。 。无符号INT32(UINT)会给你你所期望的价值。

It's a signed integer, the MSB (Most Significant Bit) generally ends up as the sign. An unsigned int32 (uint) will give you the value you expect.

看看这个MSDN页面 - 的 http://msdn.microsoft.com/en-us/library/exx3b86w(v = VS.80)的.aspx

Check out this MSDN page - http://msdn.microsoft.com/en-us/library/exx3b86w(v=vs.80).aspx

有关这是为什么检查出相关的二进制补码表示杰克逊教皇答案的链接更深入的解释。

For a more in depth explanation on why this is check out the link in Jackson Popes answer related to Two's Complement number representation.

也有一些进一步阅读

这篇关于为什么的Int32最大值是0x7FFFFFFF的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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