UNIT64 - what is it?

Everything else that doesn't fall into one of the other PB categories.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

UNIT64 - what is it?

Post by SFSxOI »

I've run into some stuff in the new API's for Vista I don't know how to represent in PureBasic. One of them is UNIT64.

What is UNIT64? How is it represented in PureBasic? Is UNIT64 a quad in PureBasic?

How would a constant something like this be represented:

Code: Select all

someconstant (0x00001ui64)
Simply like this?

Code: Select all

#someconstant = $00001

?????
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

UNIT64? or UINT64?
UINT64 is a unsigned Quad, not available in PB, but you can use Quad, is
the same memory but not the same valuerange
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

UNIT64 must be replaced by UINT64;

Yes, it's a quad;

Reference : http://www.purebasic.fr/english/viewtop ... ght=uint64
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

UNIT64, so that is a quad. Oki dokee then.

But what about the strange constant like: someconstant (0x00001ui64)

what is the ui64?

Thanks for your help :)
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

SFSxOI wrote:what is the ui64?
The "i64" and "ui64" extensions are non-standard, Microsoft compiler specific extensions used for specifing 64bit integer constants.
--Kale

Image
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Kale wrote:
SFSxOI wrote:what is the ui64?
The "i64" and "ui64" extensions are non-standard, Microsoft compiler specific extensions used for specifing 64bit integer constants.
well, crap....I was in the progress of converting the managment portion of the Windows Filtering Platform API for Vista and Server 2008, for use with PureBasic. Was going pretty smooth for a bit, had some basic functions working too, then I encountered the 'ui64' thing. So...if its microsoft compiler specific...well...just Great! :(

gotta find some way to work around it.


Thanks Folks :)
jack
Addict
Addict
Posts: 1359
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

SFSxOI I don't see the problem, 0x00001ui64 simply means that the hex value is a Quad.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

jack wrote:SFSxOI I don't see the problem, 0x00001ui64 simply means that the hex value is a Quad.
The problem is it's unsigned. There is no problem storing a 64bit number but retrieving a meaningful value from the quad is a little tricky.
--Kale

Image
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

I know this thread is a bit old, but rather then starting a new one for the same subject...

I'm just getting back to working on the Windows Filtering Platform API for Vista, had put it aside for a while. I can't figure out how to get a useful value from the ui64 thing. Any ideas anyone?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

a problem only occurs when the highest bit is set.

then, PB will interpret it as negative value.

so, when you need to check a uint64 value, you could e.g. check for the highest bit with
If Val < 0

depending on the case you need it, you should get from the documentation if the highest bit could be set by any chance.

declaring a function to use a uint64 does not mean that every value passed will have the highest bit set...
oh... and have a nice day.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

shifting will work differently too, the sign bit doesn't shift with the rest of the value (I don't think, something like that)
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

with shifting via PB the signbit remains set, iirc.
but you can call the asm command for unsigned shift.

anyhow, checking for single bits doesn't know any difference in signed or unsigned,
so checking a 64bit Flag register will work without problems.

I think the approach to deal with this will strongly depend on the purpose of this uint64 value.
oh... and have a nice day.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

what is the ASM command for unsigned shifting? that would be handy
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

isnt the result of lpperformancecounter also a UINT64 ?

i found this on a quick google - maybe useful.

http://books.google.ch/books?id=avDkMnu ... 1-PA114,M1
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> what is the ASM command for unsigned shifting?

don't know by heart... read it in a topic here not long ago.


> isnt the result of lpperformancecounter also a UINT64 ?

for handling a counter, it is meaningless if you notate it signed or unsigned.
handling the overflow is almost the same.
tho I'm unsure right now, if an overflow of some 64bit counter even can occur within the next thousand years...
oh... and have a nice day.
Post Reply