b32x, memory_index, umm, smm

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 ?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#ifdef  _WIN64
typedef unsigned __int64    size_t;
#else
typedef _W64 unsigned int   size_t;
#endif

#ifdef  _WIN64
typedef unsigned __int64    uintptr_t;
#else
typedef _W64 unsigned int   uintptr_t;
#endif
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

size_t can store the maximum size of a theoretically possible object of any type (including array).

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.
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
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
1
typedef int_least32_t b32x
We don't really need both, no - we could replace memory_index (and probably should) now that we have umm/smm.

- Casey
Btw what does mm stand for?
memory mapped?
bimbinel
Btw what does mm stand for?


It's probably an adaptation from the meaningless MMX initialism
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