Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Mötley on May 05, 2016, 01:55 PM

Title: Bitwise Operations
Post by: Mötley on May 05, 2016, 01:55 PM
So how does the VCMP server.exe work?

As in if I use a 32 bit server.exe then my limit is 32?
If I use a 64 bit server.exe then my limit is 64?

Or are they both 32 bit secretly?

does this go by digits, numbers, or lines?

I have never really actually asked to clear things up.

Example of usage

enum Admin
{
Mute = 4,
Unmute = 4,
Kick = 5,
Ban = 5,
Unban = 5,
Setlevel = 9
}
Title: Re: Bitwise Operations
Post by: Thijn on May 05, 2016, 02:10 PM
What?
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 02:12 PM
Just like what vortex said

http://forum.liberty-unleashed.co.uk/index.php/topic,2008.0.html
Title: Re: Bitwise Operations
Post by: . on May 05, 2016, 02:20 PM
What?
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 02:22 PM
Okay either I learned wrongly about Bitwise Operations by Vortex, Or either S.L.C does not know...
Title: Re: Bitwise Operations
Post by: Thijn on May 05, 2016, 02:52 PM
I can tell you it's probably the first one :P
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 02:54 PM
I will contact Vortex to see what he says. I doubt he would post a incorrect tutorial....

But you never know....
Title: Re: Bitwise Operations
Post by: KAKAN on May 05, 2016, 04:08 PM
well, that's all about integer. To be simple :D
For ex:
After 40 days of running the server, if you use GetTickCount it would return a wrong number on a x32 server since the integer would be too large to handle, more than 32 in length, it will take many months or even years on a x64 system.
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 04:22 PM
So basically Vortex is correct .

This has helped clear up my mind.
I will leave the topic open for any more vital discussions

I am still curious as to is a 64 bit server secretly a 32 bit with 64 bit support.

@Stormeus.
Title: Re: Bitwise Operations
Post by: DizzasTeR on May 05, 2016, 05:31 PM
Quote from: Mötley on May 05, 2016, 04:22 PM...is a 64 bit server secretly a 32 bit with 64 bit support...

Made my mood.
Title: Re: Bitwise Operations
Post by: Thijn on May 05, 2016, 05:38 PM
Quote from: Mötley on May 05, 2016, 04:22 PMI am still curious as to is a 64 bit server secretly a 32 bit with 64 bit support.
First you say you get it. Now you say this ridiculous statement. Are you sure you get it, because it doesn't seem like you do :P
Title: Re: Bitwise Operations
Post by: KAKAN on May 05, 2016, 05:51 PM
Quote from: Thijn on May 05, 2016, 05:38 PM
Quote from: Mötley on May 05, 2016, 04:22 PMI am still curious as to is a 64 bit server secretly a 32 bit with 64 bit support.
First you say you get it. Now you say this ridiculous statement. Are you sure you get it, because it doesn't seem like you do :P
He thinks that the x32 server is renamed as x64 and published here :D
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 06:28 PM
What I am saying is "Even if the server says 64 bit" It doesn't always mean 64 bit, many programmers will just add support from the 32 bit edition. So I need to know what the server.exe really is in the 64 bit build. If yes then that is all I need to know,  More than likely it's 64 bit.
This. Is vital believe it or not for those that do not comprehend .

Do I need to go in depth? I prefer no.
Title: Re: Bitwise Operations
Post by: . on May 05, 2016, 06:38 PM
You can always check.

if (_intsize_ == 8) print("64 bit integers");
else print("32 bit integers");
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 06:57 PM
Quote from: . on May 05, 2016, 06:38 PMYou can always check.

if (_intsize_ == 8) print("64 bit integers");
else print("32 bit integers");

Honestly I only need to know for a release I am working on as I have 32 bit

Can not test with 64 bit
Title: Re: Bitwise Operations
Post by: Stormeus on May 05, 2016, 11:16 PM
Vortrex is wrong in his tutorial. 32 bits does not mean numbers can be 32 digits long. Both of you need to read a tutorial on binary.

The server is not "32-bit with 64-bit support." That statement is literally nonsense, it means nothing. The 64-bit server is compiled to only run on 64-bit computers and runs with 64-bit instructions.
Title: Re: Bitwise Operations
Post by: Mötley on May 05, 2016, 11:35 PM
I will let him know >:(....

Thanks Stormeus! that is the reply I was looking for..... I am happy I asked
Title: Re: Bitwise Operations
Post by: Stormeus on May 05, 2016, 11:38 PM
To better answer your other question:

Quote from: Mötley on May 05, 2016, 01:55 PMAs in if I use a 32 bit server.exe then my limit is 32?
If I use a 64 bit server.exe then my limit is 64?

Yes, Squirrel on a 32-bit server will have 32-bit numbers, and Squirrel on a 64-bit server will have 64-bit numbers, so aside from mistaking bits with decimal places, you're pretty much right there.

It's also why if you compile a Squirrel file on a 32-bit server and try to run the compiled file on a 64-bit server, the script won't run: the compiled script is made for a different processor architecture.
Title: Re: Bitwise Operations
Post by: Mötley on May 06, 2016, 03:13 AM
:o I never knew that with compiled scripts

 :D Learning Something.

I am definitely going to take the time read a tutorial on binary!

I appreciate the kind responses and correct feedback. YET! pointing out reading into binary tutorials. Kudos!!!


Atleast I learned something with the studying I did,http://en.wikipedia.org/wiki/Bitwise_operation ...
But I am happy you stopped this learning process before I continued to think like this.
http://en.wikipedia.org/wiki/Bitwise_operation
Title: Re: Bitwise Operations
Post by: EK.IceFlake on May 06, 2016, 03:40 AM
They are 32 and 64 respectively. That's why if you try to compile a plugin on 32 and run it on 64 you'll get the 0x0000007b
Title: Re: Bitwise Operations
Post by: Mötley on May 06, 2016, 03:50 AM
 @ext-d.CrystalBlue

**I did not make this script, Or was it a normal release but just simply in an old random post.

// -------- Compiler Script --------
// ------ Created by VRocker -------

function onConsoleInput( cmd, text )
{
if ( cmd == "compile" )
{
if ( text )
{
local file = loadfile( "Scripts/"+text );
if ( file )
{
print( "Script " + text + " compiled successfully" );

writeclosuretofile( "Compiled Scripts/"+text + ".cnut", file );
}
else print( "Unable to load script " + text );
}
else print( "Error - Invalid arguments (compile <script>)" );
}
}

Due to the different exe builds, there will be a different outcome/support.. as Stormeus said?.

Title: Re: Bitwise Operations
Post by: EK.IceFlake on May 06, 2016, 03:52 AM
Quote from: Mötley on May 06, 2016, 03:50 AM@ext-d.CrystalBlue

**I did not make this script, Or was it a normal release but just simply in an old random post.

// -------- Compiler Script --------
// ------ Created by VRocker -------

function onConsoleInput( cmd, text )
{
if ( cmd == "compile" )
{
if ( text )
{
local file = loadfile( "Scripts/"+text );
if ( file )
{
print( "Script " + text + " compiled successfully" );

writeclosuretofile( "Compiled Scripts/"+text + ".cnut", file );
}
else print( "Unable to load script " + text );
}
else print( "Error - Invalid arguments (compile <script>)" );
}
}

Due to the different exe builds, there will be a different outcome/support.. as Stormeus said?.
Probably not. It isn't converted to native machine code, just squirrel bytecode.
Title: Re: Bitwise Operations
Post by: EK.IceFlake on May 06, 2016, 03:55 AM
Quote from: Stormeus on May 05, 2016, 11:16 PMVortrex is wrong in his tutorial. 32 bits does not mean numbers can be 32 digits long. Both of you need to read a tutorial on binary.

The server is not "32-bit with 64-bit support." That statement is literally nonsense, it means nothing. The 64-bit server is compiled to only run on 64-bit computers and runs with 64-bit instructions.
In 32 bit the maximum number held in a variable will be in 2^32. In 64 the limit is square of 32bit limit, or 2^64.
This is due to the fact that in one variable, what you have is a bunch of zeros, and you can change them to a 1. But the limitation is that you have a set amount of zeros.
Title: Re: Bitwise Operations
Post by: ysc3839 on May 06, 2016, 04:15 AM
Quote from: KAKAN on May 05, 2016, 04:08 PMwell, that's all about integer. To be simple :D
For ex:
After 40 days of running the server, if you use GetTickCount it would return a wrong number on a x32 server since the integer would be too large to handle, more than 32 in length, it will take many months or even years on a x64 system.
No. It will count again from zero.
Title: Re: Bitwise Operations
Post by: KAKAN on May 06, 2016, 04:19 AM
Quote from: ysc3839 on May 06, 2016, 04:15 AM
Quote from: KAKAN on May 05, 2016, 04:08 PMwell, that's all about integer. To be simple :D
For ex:
After 40 days of running the server, if you use GetTickCount it would return a wrong number on a x32 server since the integer would be too large to handle, more than 32 in length, it will take many months or even years on a x64 system.
No. It will count again from zero.
Haven't tested that cause from the start I'm with a x64 server, and also, we guys won't keep our server up for a extremely long time as 40 days, if we host at home :D
Title: Re: Bitwise Operations
Post by: Vortrex on May 17, 2016, 06:21 AM
Well, at the time I made that post, I didn't have a lot of knowledge on how 32 bit integers worked.
I just knew how to use bitwise operators, so that's why I put the post up so people could also learn.

I've done some reading since and I'll probably edit the tutorial once I get some time later today.
It wasn't my intention to mislead anybody.