Post Reply 
[Application Release] Sounge v1.0
Author Message
ZiNgA BuRgA
Smart Alternative

Posts: 17,022.2988
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
Offline
Post: #27
RE: [Application Release] Sounge v1.0
I'm not sure I got all what you said above, but for dynamically sizing arrays, look for the malloc() function ( C ) or the new keyword (C++).

It also may be more beneficial to use a linked list instead of an array.

What's the array for though?  Is it for storing previously known factors?  IDK, I generally wouldn't be bothered trying to implement something so complex - I'd probably do something like this:

C Code
1
2
3
4
5
6
7
int getImgHeight(int numBytes)
{
 int i = (int)sqrt(numBytes);
 while(numBytes % i)
  i--;
 return i;
}

The above gets the height of the image, then you can do a division to get the width.  It's not the fastest algorithm (O(√n)), but, even for files a few GB, it should be very fast.

(This post was last modified: 21/05/2008 06:06 PM by ZiNgA BuRgA.)
21/05/2008 06:05 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
[Application Release] Sounge v1.0 - Kaiser - 13/05/2008, 04:40 PM
RE: [Release] Sounge v1.0 - 1-R - 13/05/2008, 04:54 PM
RE: [Application Release] Sounge v1.0 - ZiNgA BuRgA - 21/05/2008 06:05 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: