Archive: Maximum Integer Value


Maximum Integer Value
Hello all.

I have an NSIS EXE that I'm playing with, and I wanted to count the number of lines it searches within a large group of text files. I'm simply using:

"IntOp $ReadLines $ReadLines + 1"

to keep track. I'm wondering what the maximum value the integer "$ReadLines" can hold. I tested up to 1 billion, and it seems to be fine, so I'm not worried about things in my little project (I'll never get that high), but was just curious, thanks all!

Jnuw


Post from kichik:

Ints are strings too in NSIS. IntOp for example, works with strings which are internally converted to ints using atoi.

Thanks dienjd. That makes sense that strings would have to be converted to in integer each time IntOp is used. I guess the question is what kind of integer is it converted to? I checked out my VB.Net book, and at least in VB there are Byte (8 bits), Short (16 bits), Integer (32 bits), and Long (64 bits). I had no problem going up to 1 billion, but could not get to 10 billion in NSIS, so I'm guessing NSIS's IntOp converts strings to just regular Integers (32 bits), which my book says has a range of +/- 2,147,483,648. That should be sufficient for what I'm doing, that's for sure! Thanks for the input.


32-bits. That's 2^32 which is 4294967296. Make sure you use IntCmpU so you'll get the full range.


Will do, thanks for the info kichik!

Jnuw