Welcome, Guest. Please login or register.

Author Topic: 64-bit AmigaDOS operations?  (Read 3376 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« on: February 03, 2004, 08:46:01 PM »
Quote
however is there support for this via dos.library?

Yes.

Quote
(I want to get the remaining free space on a partition in a >4Gb-compliant way.

Just make sure you use 64bit math, other than that it's identical to the code you use now.

ULONG NumBlocksFree;
unsigned long long NumBytesFree;
struct InfoData *id; /* assumed allocated and set up by Info() call */

NumBlocksFree = id->id_NumBlocks - id->id_NumBlocksUsed;
NumBytesFree = (unsigned long long) NumBlocksFree * id->id_BytesPerBlock;
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« Reply #1 on: February 04, 2004, 10:19:38 AM »
Quote
Each of those 2^32 blocks is a good bit bigger than one byte, 4K I think.

Typically 512 bytes.

Can be 4k too, though, but with that you lose lots of storage with small files.

Your explanation is correct, nevertheless.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« Reply #2 on: February 06, 2004, 03:00:40 PM »
Quote
These large data types cannot be output by printf or handled in any other meaningful way.

long long x = 10000000000000;
printf("%lld\n", x);

...works with any real compiler.

(Sidenote: MorphOS exec/RawDoFmt() supports "ll" and "L" for 64bit data aswell (and thus dos/Printf and friends). Also, the next release of MorphOS libnix supports 64bit formatting for printf and scanf family functions. ixemul supports 64-bit printf/scanf functions already, for AmigaOS too.)

Quote
I'd rather suggest to determine how many blocks fit into one kilobyte or one megabyte and output the free space in KB or MB.

That's a good suggestion. Usually this is enough.

Here is an example how to format such numbers: largefmt.c
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: 64-bit AmigaDOS operations?
« Reply #3 on: February 09, 2004, 11:53:03 AM »
Quote
Argh! Kill that endian bug!

It wasn't a bug, but a feature. I removed the feature though. :-)