Int_64 - 64 bit question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    Int_64 - 64 bit question

    Hi,

    I am a little confused as to how numbers are represented as 64 bit
    integers.

    I have a file that is 2GB in size.

    I call __stati64 and from the st_size attribute, I see that the size
    is returned as:

    High - 0
    Low - 2147483648

    I know that high and low are unsigned and can be a maximum of 2**32
    (ie. 4,294,967,296 bytes 4Gb)

    So my question is, how is a 5Gb file represented in st_size??

    Would it be:
    High - 1
    Low - 1073741824

    My hardrive on my laptop is not big enough to test this and I cannot
    find an answer on the web.
  • Victor Bazarov

    #2
    Re: Int_64 - 64 bit question

    Alex wrote:[color=blue]
    > I am a little confused as to how numbers are represented as 64 bit
    > integers.[/color]

    What do you think is the difference between those and 32-bit ones or
    16-bit ones? None, AFA C++ is concerned.
    [color=blue]
    > I have a file that is 2GB in size.
    >
    > I call __stati64 and from the st_size attribute, I see that the size
    > is returned as:
    >
    > High - 0
    > Low - 2147483648[/color]

    What's __stati64? It's not a standard function. What does it return?
    What's "High" and "Low"? Some 32-bit parts of a struct?
    [color=blue]
    > I know that high and low are unsigned and can be a maximum of 2**32
    > (ie. 4,294,967,296 bytes 4Gb)[/color]

    If they are 32-bit unsigned integers, then the maximum is (2**32 - 1),
    actually. That's 4,294,967,295.
    [color=blue]
    >
    > So my question is, how is a 5Gb file represented in st_size??
    >
    > Would it be:
    > High - 1
    > Low - 1073741824[/color]

    _Assuming_ that 'High' and 'Low' are of type "unsigned long", then, yes,
    _probably_.
    [color=blue]
    > My hardrive on my laptop is not big enough to test this and I cannot
    > find an answer on the web.[/color]

    Try the FM for your compiler. You know, the second part of RTFM...

    V

    Comment

    Working...