diff options
Diffstat (limited to 'src/arch/archbase.h')
| -rw-r--r-- | src/arch/archbase.h | 25 | 
1 files changed, 25 insertions, 0 deletions
diff --git a/src/arch/archbase.h b/src/arch/archbase.h index 24cfd77..fc6fe4d 100644 --- a/src/arch/archbase.h +++ b/src/arch/archbase.h @@ -74,6 +74,31 @@ typedef enum _MemoryDataSize  #define MDS_IS_SIGNED(mds) (mds & 0x80) +#define MDS_FROM_BYTES(sz)                          \ +    ({                                              \ +        MemoryDataSize __result;                    \ +        switch (sz)                                 \ +        {                                           \ +             case 1:                                \ +                 __result = MDS_8_BITS_UNSIGNED;    \ +                 break;                             \ +             case 2:                                \ +                 __result = MDS_16_BITS_UNSIGNED;   \ +                 break;                             \ +             case 4:                                \ +                 __result = MDS_32_BITS_UNSIGNED;   \ +                 break;                             \ +             case 8:                                \ +                 __result = MDS_64_BITS_UNSIGNED;   \ +                 break;                             \ +             default:                               \ +                 __result = MDS_UNDEFINED;          \ +                 break;                             \ +        }                                           \ +        __result;                                   \ +    }) + +  #define MDS_4_BITS  MDS_4_BITS_UNSIGNED  #define MDS_8_BITS  MDS_8_BITS_UNSIGNED  #define MDS_16_BITS MDS_16_BITS_UNSIGNED  | 
