KabukiStarship/Script2

Spec.Data.PODTypesTable: Reorder elements so it's faster to parse

Closed this issue · 0 comments

Mission

Problem

The problem I am addressing on this mission is that the BOL being where it is messes everything up.

Solution

The solution that I'm addressing on this mission is to recorder the ASCII Data Types POD table as follows:

ID Type C++/Alt Name Width Description
0 NIL null 0 Nil/null/void type.
1 IUA uint8_t 1 1-byte unsigned integer.
2 ISA int8_t 1 1-byte signed integer.
3 CHA char 1 1-byte Unicode/ASCII character.
4 FPB half 2 2-byte floating-point number.
5 IUB uint16_t 2 2-byte unsigned integer.
6 ISB int16_t 2 2-byte signed integer.
7 CHB char16_t 2 2-byte Unicode character.
8 FPC float 4 4-byte floating-point number.
9 IUC uint32_t 4 4-byte unsigned integer.
10 ISC int32_t 4 4-byte signed integer.
11 CHC char32_t 4 4-byte Unicode character.
12 FPD double 8 8-byte floating-point number.
13 IUD uint64_t 8 8-byte unsigned integer.
14 ISD int64_t 8 8-byte signed integer.
15 TME int64_t 8 ISC seconds since epoch timestamp with a IUC sub-second tick.
16 FPE float128_t 16 16-byte floating-point number.
17 IUE uint128_t 16 16-byte unsigned integer.
18 ISE int128_t 16 16-byte signed integer.
19 BOL bool 1/2/4 Implementation-defined 1-bit or 1, 2, or 4-byte boolean value.
20 DTA Data Type A xW Implementation-defined word-aligned Data Type A.
21 DTB Data Type B xW Implementation-defined word-aligned Data Type B.
22 DTC Data Type C xW Implementation-defined word-aligned Data Type C.
23 DTD Data Type D xW Implementation-defined word-aligned Data Type D.
24 DTE Data Type E xW Implementation-defined word-aligned Data Type E.
25 DTF Data Type F xW Implementation-defined word-aligned Data Type F.
26 DTG Data Type G xW Implementation-defined word-aligned Data Type G.
27 DTH Data Type H xW Implementation-defined word-aligned Data Type H.
28 DTI Data Type I xW Implementation-defined word-aligned Data Type I.
29 DTJ Data Type J xW Implementation-defined word-aligned Data Type J.
30 DTK Data Type K xW Implementation-defined word-aligned Data Type K.
31 DTL Data Type L xW Implementation-defined word-aligned Data Type L.

Justification for Ordering

The table logic is based on the fact that there are only three types of Unicode character types, 8-bit, 16-bit, and 32-bit, and there are only four main types of floating-point numbers, 16-bit, 32-bit, 64-bit, and 128-bit. We always know that 0 will be nil, so thus we may conclude that FPB must be in index 4 because there is no such thing as an 8-bit floating-point number.

It doesn't make sense to start out with FPx, CHx, ISx, IUx, so it must start out either FPx, ISx, IUx, or FPx, IUx, ISx, but you cannot create a signed integer without an unsigned inter, and thus the unsigned integers must come first, yielding the order FPx, IUx, ISx CHx,.

We require a special type for a 64-bit timestamp. With the above order packing there is no room for a 4-bit timestamp, but there is no 64-bit Unicode character value, and thus we may conclude that TME is required to be Type 15.

This leaves one type left we can use to store our BOL type, which is Type 19. After that are all implementation-defined types the user can place any other types where they see fit; and it's arguable that you really actually need any other POD data types for the vast majority of foreseeable of applications.

File Affected

  1. ?

Hierarchy

Tags

Mission

A

Sessions

License

Copyright 2023 Kabuki Starship; all rights reserved.