mrmixer
Simon Anciaux
539 posts
|
#8140
b32x, memory_index, umm, smm 2 years, 6 months ago
In one of the last episodes, Casey tried to use the b32x type which is not defined in the handmade hero code base. What would be the purpose (or conceptual meaning) of that type, and would it be the same typedef as b32 ?
On the same topic what are the different use case for memory_index (size_t) and umm (uintptr_t) as they are defined exactly the same way ?
|
graeme
34 posts
|
#8144
b32x, memory_index, umm, smm 2 years, 6 months ago
Can't speak to b32x, but size_t and uintptr_t can be defined differently on certain platforms
From cppreference uintptr_t - unsigned integer type capable of holding a pointer As I understand it on systems with segmented memory, size_t used as an index would hold only an offset within a segment, but uintptr_t would hold both a segment and an offset. |
cmuratori
Casey Muratori
817 posts
/ 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero. |
#8145
b32x, memory_index, umm, smm 2 years, 6 months ago
b32x is just "boolean value in whatever size is comfortable for the compiler but not less than 32 bits." It's what you use when you're working with s32/u32 and want to store a boolean but don't care if it expands to 64 bits (or more) on some theoretical architecture where that was more efficient.
- Casey |
mrmixer
Simon Anciaux
539 posts
|
#8149
b32x, memory_index, umm, smm 2 years, 6 months ago
I would like to rephrase my question: Given that memory_index and umm are implemented the same, are there cases where you specifically use memory_index or umm to give additional meaning to some code ?
@cmuratori: So is it
|
cmuratori
Casey Muratori
817 posts
/ 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero. |
#8159
b32x, memory_index, umm, smm 2 years, 6 months ago
We don't really need both, no - we could replace memory_index (and probably should) now that we have umm/smm.
- Casey |
bimbinel
14 posts
|
#10461
b32x, memory_index, umm, smm 2 years, 1 month ago
Btw what does mm stand for?
|
mmozeiko
Mārtiņš Možeiko
1882 posts
/ 1 project
|
#10462
b32x, memory_index, umm, smm 2 years, 1 month ago
memory mapped?
|
ratchetfreak
429 posts
|
#10463
b32x, memory_index, umm, smm 2 years, 1 month ago bimbinel It's probably an adaptation from the meaningless MMX initialism |
cmuratori
Casey Muratori
817 posts
/ 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero. |
#10464
b32x, memory_index, umm, smm 2 years, 1 month ago
It's just a shorthand for "the size that a pointer is". There's no rhyme or reason for it. The "m" stands for "memory" but there's no reason it has to be two of them, I think I just liked the way that looked better than "um" and "sm".
- Casey |