The Forum is up for sale: XeNTaX Forum looking for new owner

quickbms unsigned integer

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

quickbms unsigned integer

Post by finale00 »

0xFFFF gives 65335
0xFFFFFFFF gives -1

I want it to give 4294967295 though.
How do I do that?

Code: Select all

math temp = 0xFFFFFFFF

math temp = 4294967295
Both result in -1
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1411 times

Re: quickbms unsigned integer

Post by chrrox »

set it as a long long data type?
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: quickbms unsigned integer

Post by finale00 »

Code: Select all

set temp longlong 0xFFFFFFFF
Still gives -1 though.

I'm only using 0xFFFFFFF as an example, but this applies to basically any situation where you want to work with large, unsigned values.

It messes up the XOR'ing.

I also want to read in unsigned integers, but longlong using get still returns signed integers.

The readme says everything is done using 32-bit signed integers, but there's no way to force it to use 32-bit unsigned? The encryption I'm working with uses 32-bit unsigned integers everywhere and the key itself is a huge 32-bit unsigned integer.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 661 times
Contact:

Re: quickbms unsigned integer

Post by aluigi »

use the 'u' before any math operation to force unsigned numbers.

example:

signed operation:

Code: Select all

math MYVAR /= 1234
unsigned operation:

Code: Select all

math MYVAR u/= 1234
Post Reply