Re: Robert - Ularge_Integers

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks Robert and Daniel,
This should help allot.

Thanks,
JKinsey

-----Original Message-----
From: Euphoria Programming for MS-DOS
[mailto:EUPHORIA at LISTSERV.MUOHIO.EDU]On Behalf Of Robert Craig
Sent: Wednesday, February 10, 1999 9:20 PM
To: EUPHORIA at LISTSERV.MUOHIO.EDU
Subject: Re: Robert - Ularge_Integers


John Kinsey writes:
> Can EU handle Ularge_Integers?  I would like to
> write a wrapper for the GetDiskFreeSpace and
> GetDiskFreeSpaceEx functions
> but the problem is that the GetDiskFreeSpaceEx function
> returns Ularge_Integers which are 64bit in size...
> you need this function to get the drive size for drives
> larger than 2.1 GB in size on Win9x OSR2 or higher.

Euphoria's integer type goes up to 31 bits.
Euphoria's atom type allows exact integer values up to the
mantissa size of IEEE double-precision floating-point.
I believe IEEE double-precision is something like:

52-bit mantissa
11-bit exponent
1-bit sign
------------
64-bit total

A number like 2.1 Gb won't fit in an integer,
but numbers a million times (i.e. 20-bits) greater should
fit in an atom with no loss of precision.

The 64-bit numbers "returned" by GetDiskFreeSpaceEx()
are returned via pointers to this structure, passed as arguments:

typedef struct _ULARGE_INTEGER {
    DWORD LowPart;
    DWORD HighPart;
} ULARGE_INTEGER;

You would have to allocate() 8 bytes for each number
and pass the addresses to GetDiskFreeSpaceEx().
After the call you could multiply the HighPart's by power(2,32)
and add them to the LowParts. (use peek4u())
The results should be stored in Euphoria atoms.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu