Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Max int

Max int

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Dace K   Canada  (169 posts)  Bio
Date Tue 16 Sep 2003 06:22 AM (UTC)
Message
Hey, is there any way to increase max integer from
2,147,483,647? :P
I'd appreciate any help..

ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #1 on Tue 16 Sep 2003 03:17 PM (UTC)
Message
Not too likely, no. That's system dependent. You could use "long" types though if you REALLY want to have gigantic numbers available.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Tue 16 Sep 2003 06:57 PM (UTC)
Message
unsigned long long stores a large number, more than a trillion. That should be enough for whatever you need. You'll need to use %llu also.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Dace K   Canada  (169 posts)  Bio
Date Reply #3 on Tue 16 Sep 2003 11:36 PM (UTC)

Amended on Tue 16 Sep 2003 11:55 PM (UTC) by Dace K

Message
Never worked with ull before,
can you go a bit more into detail on the code
to assign it to a value? :P
Thanks.

ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

Posted by Dace K   Canada  (169 posts)  Bio
Date Reply #4 on Wed 17 Sep 2003 12:01 AM (UTC)
Message
Er.. I took a look around the forums, and as far
as I can tell, this would be what I should do..

unsigned long long <value>;

and then change every %d display for that value
to %llu.

That right? ;)

ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Wed 17 Sep 2003 12:49 AM (UTC)

Amended on Wed 17 Sep 2003 02:00 AM (UTC) by Zeno

Message
Yeah, thats right. One thing that I found a problem with it, is that the num_punct doesn't work with it. You have to make a new num_punct function. If your going to use comma's, then I'll gladly post the new function. Just ask.

[EDIT] Argh, typos.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Dace K   Canada  (169 posts)  Bio
Date Reply #6 on Wed 17 Sep 2003 01:19 AM (UTC)

Amended on Wed 17 Sep 2003 01:58 AM (UTC) by Dace K

Message
Updated code, it works like a dream. Thanks :).
I was gonna rewrite the num_punct myself, but if you have one handy I'd love to use it instead :D


ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #7 on Wed 17 Sep 2003 02:02 AM (UTC)
Message
Well, I wouldn't rewrite it, then the old variables like int may not display corretly. I made a new num_punct function right under it called num_punct_llu. If you run into trouble making it, I'll just post mine.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Dace K   Canada  (169 posts)  Bio
Date Reply #8 on Wed 17 Sep 2003 02:48 AM (UTC)
Message
Well, I wrote a function for num_punct_llu(long long foo)..
compiled it with no errors except for a warning where the function is called, so it completely fails to work.
Could you post your func please? :D

ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #9 on Wed 17 Sep 2003 07:22 PM (UTC)
Message
Sure. Under num_punct this should go

char *num_punct_llu(long long unsigned foo)
{
    int index, index_new, rest;
    char buf[16];
    static char buf_new[16];

    sprintf(buf,"%llu",foo);
    rest = strlen(buf)%3;

    for (index=index_new=0;index<strlen(buf);index++,index_new++)
    {
        if (index!=0 && (index-rest)%3==0 )
        {
            buf_new[index_new]=',';
            index_new++;
            buf_new[index_new]=buf[index];
        }
        else
            buf_new[index_new] = buf[index];
    }
    buf_new[index_new]='\0';
    return strdup(buf_new);
}

When you use this for a variable, don't use %llu, since its already used in here. Just use %s. For example.

pager_printf_color(ch, "Variable: %s\n\r", num_punct_llu(ch->vr) );

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Dace K   Canada  (169 posts)  Bio
Date Reply #10 on Thu 18 Sep 2003 01:20 AM (UTC)
Message
ahhh. My function was correct then, I just needed to change
the calls from %llu to %s.
Thanks for your help.

ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


22,257 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.