View Single Post
Old 08-07-2006, 02:14 AM   #3 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 741
DJMaze is on a distinguished road
Quote:
Originally Posted by AssKoala
So, with that code, it will not crash regardless of how big the input filesize is. If you used the above memory types (mem_types[]) in your code, you would read outside of your array for anything larger than 1023 GB.
Yes i should have posted:
PHP Code:
    // the filesize to calculate
    
double filesize 22825
I didn't because Windows mostly uses DWORD for filesizes and DWORD is unsigned long, so Windows will crash on terrabytes anyway.

Yours is slick as well, i've used a variant of that many times.
PHP Code:
while (fileSize_Bytes >= base)
{
    
fileSize_Bytes /= base;
    ++
baseLevel;
}
if (
baseLevel 8baseLevel 8
It does the same but also infinite.

I just wanted one using math.h and try to reduce the ammount of code used, and i must say it can't be less then 4 lines
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote