Reply to thread
GBAtemp.net - The Independent Video Game Community
Search
Search titles only
By:
Search titles only
By:
Reply to thread
GBAtemp.net - The Independent Video Game Community
Home
Log in
Terms & Rules
Donate
Forums
New posts
Search forums
Groups
Public Events
New
New posts
New resources
New blog entries
New profile posts
New blog entry comments
New threadmarks
Latest activity
Cheats
Cheat Codes Add and Request group
The Legend of Zelda: Tears of the Kingdom cheat codes
Pokémon Legends: Arceus cheat codes
Xenoblade Chronicles 3 cheat codes
Fire Emblem Engage cheat codes
Request a cheat...
Tutorials
Nintendo Switch tutorials
Nintendo 3DS tutorials
Nintendo Wii U tutorials
Reviews
Overview
Official reviews
User reviews
Downloads
Latest reviews
Search resources
Blogs
New entries
New comments
Blog list
Search blogs
Chat
Top chatters
Search
Search titles only
By:
Search titles only
By:
Log in
Register
New posts
Search forums
Log in
Register
Home
Forums
PC, Console & Handheld Discussions
Nintendo DS
Who wants Duke Nukem 3D (JFDuke?) on the DSi?
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mrparrot2" data-source="post: 9899741" data-attributes="member: 575083"><p>If the problem is just the size of the static structures but not memory, the following transformation can be done:</p><p></p><p>Single dimensional arrays can be redeclared as</p><p> int A[MAX];</p><p>to</p><p> int *A;</p><p></p><p>Multidimensional arrays can be redeclared from:</p><p> int B[M][N];</p><p>to</p><p> int (*B)[N]; // M can be discarded as only the array's pitch is necessary.</p><p></p><p>Then allocation can be done in</p><p></p><p>void __attribute__((constructor)) Initialize_Static_Data(void) {</p><p> static bool initialized = false;</p><p></p><p> if (!initialized) {</p><p> A = (int *) malloc(MAX * sizeof(int));</p><p> B = ((int (*)[N]) malloc(M * N * sizeof(int));</p><p> initialized = true;</p><p> }</p><p>}</p><p></p><p></p><p>The trick here is is to create a function that will be placed on the C++ initialization section and, since this is C code, it will run before everything (even main). And C11 (maybe even C99?) and above allows casting a pointer to a matrix, although this isn't really widespread knowledge. Then B<em>[ i][j] will automatically remaps to (B address) + (i*N + j) * sizeof(int).</em></p></blockquote><p></p>
[QUOTE="mrparrot2, post: 9899741, member: 575083"] If the problem is just the size of the static structures but not memory, the following transformation can be done: Single dimensional arrays can be redeclared as int A[MAX]; to int *A; Multidimensional arrays can be redeclared from: int B[M][N]; to int (*B)[N]; // M can be discarded as only the array's pitch is necessary. Then allocation can be done in void __attribute__((constructor)) Initialize_Static_Data(void) { static bool initialized = false; if (!initialized) { A = (int *) malloc(MAX * sizeof(int)); B = ((int (*)[N]) malloc(M * N * sizeof(int)); initialized = true; } } The trick here is is to create a function that will be placed on the C++ initialization section and, since this is C code, it will run before everything (even main). And C11 (maybe even C99?) and above allows casting a pointer to a matrix, although this isn't really widespread knowledge. Then B[I][ i][j] will automatically remaps to (B address) + (i*N + j) * sizeof(int).[/I] [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
PC, Console & Handheld Discussions
Nintendo DS
Who wants Duke Nukem 3D (JFDuke?) on the DSi?
General chit-chat
Help
Users
Settings
Notifications
Miscellaneous
Inverse message direction
Display editor on top
Enable maximized mode
Display images as links
Hide bot messages
Hide statuses
Hide chatter list
Show messages from ignored users
Temporarily disable chat
Receive mention alerts
Sound notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Desktop notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Options
Options
View top chatters
BigOnYa
Loading…
K3Nv2
Loading…
Veho
Loading…
@
K3Nv2
:
https://www.walmart.com/ip/1837406882
32 minutes ago
@
BigOnYa
:
Crazy, I remember posing for that one, towelie was messed up in that shoot.
30 minutes ago
@
Veho
:
Must have edited him in post, he looks fine there.
28 minutes ago
@
Veho
:
Here, on the other hand...
https://www.walmart.com/ip/Youtooz-South-Park-Collection-Towelie-Vinyl-Figures-4/5131687574
+1
27 minutes ago
@
BigOnYa
:
That's true, both our eyes are straight white, and we know better
27 minutes ago
@
K3Nv2
:
You're a towel
24 minutes ago
@
BigOnYa
:
No, you're a towel
24 minutes ago
@
K3Nv2
:
No you're a towel
23 minutes ago
@
BigOnYa
:
No you're a......wut. Wanna get hjgh?
21 minutes ago
@
K3Nv2
:
Crazy people actually spend $50 on that stuff
20 minutes ago
@
BigOnYa
:
Towelie runs my farm, he's awesome.
20 minutes ago
@
SylverReZ
:
@K3Nv2
, Polly is still around from what I've heard.
19 minutes ago
@
K3Nv2
:
@SylverReZ
, is Pollys alt I knew it
18 minutes ago
@
BigOnYa
:
Yea I see him every once whi!e , incognito
18 minutes ago
@
SylverReZ
:
@K3Nv2
, I'm not him. Keep looking.
+1
16 minutes ago
@
K3Nv2
:
Still don't know why he left unless someone really hurt his feelings
15 minutes ago
@
K3Nv2
:
Don't know why people get so emotional online just get over it ffs
+2
13 minutes ago
@
BigOnYa
:
He was the ass of gbatemp, everyone knocked on him, I honestly felt bad, even though I was guilty myself, but he egged it all on himself,
13 minutes ago
@
BigOnYa
:
But he still here, but under dif name, he pm me sometimes still even.
13 minutes ago
@
K3Nv2
:
It's like they think we'll be in their bed pissing on it the next day
12 minutes ago
@
BigOnYa
:
I feel like gbatemp should make t-shirts or memorabilia to remember the lost ones. I bet the Polly shirts would sell out quick.
6 minutes ago
@
K3Nv2
:
Nah that could actually bring lawsuits
5 minutes ago
@
K3Nv2
:
Tempsuits
4 minutes ago
@
BigOnYa
:
PollySuits
4 minutes ago
@
BigOnYa
:
Your correct, Somebody would be guilty and there would be riots, then they storm the gbatemp capitol,
1 minute ago
Submit
@
BigOnYa
:
Your correct, Somebody would be guilty and there would be riots, then they storm the gbatemp...
1 minute ago
Chat
3