introduced member query macro to do a better 32 bit fix

master
Allen Webster 2017-06-22 21:42:03 -04:00
parent bbb8f6f3a9
commit 4cbf3e2ff9
2 changed files with 7 additions and 2 deletions

View File

@ -43,6 +43,10 @@ typedef int32_t b32_4tech;
# define Assert(n) do{ if (!(n)) *(int*)0 = 0xA11E; }while(0) # define Assert(n) do{ if (!(n)) *(int*)0 = 0xA11E; }while(0)
#endif #endif
#if !defined(Member)
# define Member(T, m) (((T*)0)->m)
#endif
#if !defined(API_EXPORT) #if !defined(API_EXPORT)
# define API_EXPORT # define API_EXPORT
#endif #endif
@ -78,7 +82,7 @@ DOC_RETURN(Returns the memory size, in bytes, needed to allocate a table for the
memsize += 8 + (len+3)&(~3); memsize += 8 + (len+3)&(~3);
} }
u32_4tech table_count = (str_count * 3) / 2; u32_4tech table_count = (str_count * 3) / 2;
memsize += table_count*sizeof(u64_4tech); memsize += table_count*sizeof(*Member(Cpp_Keyword_Table, keywords));
return(memsize); return(memsize);
} }
@ -97,7 +101,7 @@ DOC_RETURN(Returns the memory size, in bytes, needed to allocate a table for the
memsize += 8 + (len+3)&(~3); memsize += 8 + (len+3)&(~3);
} }
u32_4tech table_count = (str_count * 3)/2; u32_4tech table_count = (str_count * 3)/2;
memsize += table_count*sizeof(u64_4tech); memsize += table_count*sizeof(*Member(Cpp_Keyword_Table, keywords));
return(memsize); return(memsize);
} }

View File

@ -46,6 +46,7 @@ typedef double f64;
#define ArrayCount(a) ((sizeof(a))/(sizeof(*a))) #define ArrayCount(a) ((sizeof(a))/(sizeof(*a)))
#define ExpandArray(a) (a), (ArrayCount(a)) #define ExpandArray(a) (a), (ArrayCount(a))
#define AllowLocal(c) (void)(c) #define AllowLocal(c) (void)(c)
#define Member(T, m) (((T*)0)->m)
#if defined(Assert) #if defined(Assert)
# undef Assert # undef Assert