* Return the size in bytes of a certain type of normal/atomic variable * as it appears in a saved game. See VarTypes * @param conv VarType type of variable that is used for calculating the size * @return Return the size of this type in bytes */
| 634 | * @return Return the size of this type in bytes |
| 635 | */ |
| 636 | static inline uint8_t SlCalcConvFileLen(VarType conv) |
| 637 | { |
| 638 | switch (GetVarFileType(conv)) { |
| 639 | case SLE_FILE_END: return 0; |
| 640 | case SLE_FILE_I8: return sizeof(int8_t); |
| 641 | case SLE_FILE_U8: return sizeof(uint8_t); |
| 642 | case SLE_FILE_I16: return sizeof(int16_t); |
| 643 | case SLE_FILE_U16: return sizeof(uint16_t); |
| 644 | case SLE_FILE_I32: return sizeof(int32_t); |
| 645 | case SLE_FILE_U32: return sizeof(uint32_t); |
| 646 | case SLE_FILE_I64: return sizeof(int64_t); |
| 647 | case SLE_FILE_U64: return sizeof(uint64_t); |
| 648 | case SLE_FILE_STRINGID: return sizeof(uint16_t); |
| 649 | |
| 650 | case SLE_FILE_STRING: |
| 651 | return SlReadArrayLength(); |
| 652 | |
| 653 | case SLE_FILE_STRUCT: |
| 654 | default: |
| 655 | NOT_REACHED(); |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | /** Return the size in bytes of a reference (pointer) */ |
| 660 | static inline size_t SlCalcRefLen() |
no test coverage detected