X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftoken.h;h=75f76fbed19c1b7c7f752093de92ea40102c0051;hp=fcf3f4e49f5b3ced600063831438944539db3cb3;hb=f15288e185e65bcdfde87c217fb6bd7ff12eb653;hpb=2f5af21b263403997e154658635d6b6e6eaab453 diff --git a/src/token.h b/src/token.h index fcf3f4e..75f76fb 100644 --- a/src/token.h +++ b/src/token.h @@ -51,6 +51,8 @@ static inline size_t psi_offset_padding(size_t diff, size_t alignment) { typedef int token_t; +#include "token_oper_cmp.h" + static inline size_t psi_t_alignment(token_t t) { #define PSI_ALIGNOF(T) case PSI_T_## T: return ALIGNOF_## T ##_T; @@ -72,6 +74,10 @@ static inline size_t psi_t_alignment(token_t t) return ALIGNOF_VOID_P; case PSI_T_ENUM: return ALIGNOF_INT; +#ifdef HAVE_LONG_DOUBLE + case PSI_T_LONG_DOUBLE: + return ALIGNOF_LONG_DOUBLE; +#endif default: assert(0); } @@ -94,13 +100,18 @@ static inline size_t psi_t_size(token_t t) return SIZEOF_FLOAT; case PSI_T_DOUBLE: return SIZEOF_DOUBLE; + case PSI_T_VOID: case PSI_T_POINTER: case PSI_T_FUNCTION: return SIZEOF_VOID_P; case PSI_T_ENUM: return SIZEOF_INT; +#ifdef HAVE_LONG_DOUBLE + case PSI_T_LONG_DOUBLE: + return SIZEOF_LONG_DOUBLE; +#endif default: - assert(0); + assert(!t); } return 0; } @@ -108,12 +119,12 @@ static inline size_t psi_t_size(token_t t) static inline const char *psi_t_indent(unsigned level) { static const char indent[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; - return &indent[32 - MAX(0, MIN(32, level))]; + return &indent[32 - MIN(32, level)]; } static inline const char *psi_t_indirection(unsigned pointer_level) { static const char indir[] = "********************************"; - return &indir[32 - MAX(0, MIN(32, pointer_level))]; + return &indir[32 - MIN(32, pointer_level)]; } struct psi_token {