Welcome, Guest. Please login or register.

Author Topic: 64 bit integers in SAS/C  (Read 12642 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline nOw2Topic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 194
    • Show all replies
64 bit integers in SAS/C
« on: July 21, 2013, 01:46:35 PM »
What's the best way to handle large numbers in SAS/C?

I want to calculate disk space for >4GB partitions. 64 bit would be ideal, but 48bit would work for now. Possibly also need to pass the numbers through library calls too, but that's a secondary issue.
 

Offline nOw2Topic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 194
    • Show all replies
Re: 64 bit integers in SAS/C
« Reply #1 on: July 21, 2013, 08:53:36 PM »
The value needs to be passed around in bytes (to support existing code and also importantly maintain resolution), it's not just the issue of reading the size from disk. Though that does the question of doing that - I'd want to maintain accuracy so would need the true size of disks/files rather than the more granular block sizes.

I'm not confident of patching the compiler with experimental code. SAS/C 6.5x is a restriction at the moment.

I'm thinking of using two longs to hold the data, even if that makes calculations interesting. UtilityBase functions may be suitable for that, otherwise I'll roll my own. This way existing code will continue to work as it does today (little-endian style) and new code can be adapted to see the higher bytes.

Then I need to work out how to write that as human readable - converting to display in MB/GB/TB I think should be okay as by that point the calculation will leave a single long suitable for sprintf, but starting to worry myself about how to get the large >2^32 byte values out in ASCII.
 

Offline nOw2Topic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 194
    • Show all replies
Re: 64 bit integers in SAS/C
« Reply #2 on: July 24, 2013, 12:37:38 PM »
Quote from: olsen;741551
Have a look at the http://aminet.net/comm/tcp/SendRawDisk.lha utility which I wrote a while ago (full source code included). It includes both 64 bit arithmetic code written in portable 'C', as well a complete set of functions for accessing "large disks" (covering both NSD/TD64, with auto-detection of some sort which handles both sets transparently).


Just a quick reply to say thanks as that is exactly what I was looking for. I didn't know where to start but that gets me going in the right direction.

I now have Directory Opus 5 reporting disk sizes correctly. Next job, calculations for files and directories.
 

Offline nOw2Topic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 194
    • Show all replies
Re: 64 bit integers in SAS/C
« Reply #3 on: July 24, 2013, 06:25:47 PM »
Yes, or 5.82 Magellan 2 at least. It was open sourced through a bounty. And no, it doesn't support 64bit maths on sizes :)