If I enter 174 * 256 * 256 * 256 into the viewport in the C # debugger, the result will be -1375731712. I guess this has something to do with 256, but I would appreciate a little guidance.
Thank!!
Try entering this:
174 * 256 * 256 * 256f
therefore, the result will not be transmitted as an integer, but as a float.
No, it has nothing to do with 256. This is simply the result of this multiplication greater than the maximum possible signed 32-bit integer, so you got an overflow.
Try this instead:
174L * 256L * 256L * 256L
These are 64-bit integer literals.
unchecked ( ). : Int32.MaxValue + 1 == Int32.MinValue, .
unchecked
, int http://en.wikipedia.org/wiki/Two's_complement
. System.Numerics.BigInteger, (, ). a long (64- )
System.Numerics.BigInteger
long
. - 2,919,235,584, 2,147,483,647 . unsigned int (uint), , , . , , , . 174L * 256L * 256L * 256L
. :
(uint)(174 * 256 * 256 * 256)