Skip to content

Spec.Data.Add: Map from TMD and TME Subsecond Id to any other type #316

@AStarCale

Description

@AStarCale

Problem

The problem is that I ran out of bits with the new 16-bit/14-bit ASCII Data Type bit pattern, I only had 4-bits. I would also like to map a 128-bit LID to any type because it's an extremely common database operation. It would not make sense to make a map of a 128-bit float to another type because that's such an obscure use case, so I just need to be able to map a LID to any of the 512 Mappable Types.

Solution

The solution is to use the new extended 13-bit ASCII Data Type bit pattern. The two MSb are used to store if it's mutable, a pointer, a Crabs index, or Extended Type, leaving 14-bits with one bit to store if it's an Extended Context Type, leaving 13 bits. We need 7 bits for the two SW_VT (Size Width and Vector Type) bits and 5 POD type bits, leaving 6 bits, or 64 values. We need at least a 32-bit and 64-bit Map of LID-to-Standard type. The question is then do we need a map of a IUE or ISE (128-bit signed or unsigned integer)-to-Standard type? Why not map a 256, 512, etc bit integer?

The reason why I chose to use 4-bit map types (when there are 32 POD types) is that the CPU compares in words, and the data structure used for a double word value, which also could be a 64-bit value on a 32-bit CPU or 128-bit value on a 64-bit CPU, is different for different CPUs and compilers. GCC supports 128-bit integers but VC++ does not. For the 64-bit types, the compiler will do the heavy lifting for us, but for 128-bit values the CPU cannot because the CPU cannot address more than two registers for an operation with carry out flag on 32-bit systems and when you use four registers you have to use a software hack. 16-bit SCRIPT Systems operate on a restricted set so this does not apply to them. This limitation only applies to 64-bit CPUs with compilers that support 128-bit values.

The first set of 13-bits is reserved, and we're only using 32-bit and 64-bit types, so the second set is also reserved to preserve the bit pattern. The MSb of the reserved types is 0b100... and 0b101.... We need 9 bits for the 512 Standard and Context Types, leaving 4 bits, or 16 values.

2+12-bit Extended Class Blocks

Value Code Description
00 IU0 0 is NIL and A block of 0-512 bytes.
01 IU1 A block of 512-1023 bytes.
02 IU2 A block of 1024-1536 bytes.
03 IU3 A block of 1540-2047 bytes.
04 CIG A Global Crabs Index.
05 CIS A Scoped Crabs Index.
06 ECT Extended Context Types.
07 ESA Extended Standard Types 0-511.
08 CHa An 11-bit Void Unicode value 0-511.
09 CHb An 11-bit Void Unicode value 512-1023.
09 CHc An 11-bit Void Unicode value 1024-1535.
11 CHd An 11-bit Void Unicode value 1536-2047.
12 VS0 A positive 11-bit Void Signed Integer 0 to 511
13 VS1 A positive 11-bit Void Signed Integer 512 to 1023.
14 VS2 A negative 11-bit Void Signed Integer -512 to 0
15 VS3 A negative 11-bit Void Signed Integer -513 to -1024.

Extended Standard Types

You cannot create a Map type (of POD type 0-15) Extended Standard Types.

ID Type Name Description
00 Any Wildcard Wildcard; can be any type.
01 INV Invalid Marks an invalid type in a B-Sequence.
02 VSB Varint 16-bit signed varint.
03 VUB Varint 16-bit unsigned varint.
04 VSC Varint 32-bit signed varint.
05 VUC Varint 32-bit unsigned varint.
06 VSD Varint 64-bit signed varint.
07 VUD Varint 64-bit unsigned varint.
08 STA String Nil-terminated UTF-8 string.
09 STB String Nil-terminated UTF-16 string.
10 STC String Nil-terminated UTF-32 string.
11 RSa Reserved Reserved.
12 RSb Reserved Reserved.
13 RSc Reserved Reserved.
14 RSd Reserved Reserved.
15 RSe Reserved Reserved.
16 ERA Error 1-byte Error type.
17 ERB Error 2-byte Error type.
18 ERC Error 4-byte Error type.
19 ERD Error 8-byte Error type.
20 EOA Err Object 1-byte size-width Error type.
21 EOB Err Object 2-byte size-width Error type.
22 EOC Err Object 4-byte size-width Error type.

Extended Pow2 Blocks [0-31]

Extended Pow2 Types IUa through IUz are blocks of 2^(12 + k) bytes, which addresses between 2KB and 128GB of RAM. These bits are stolen from the Context Types 485 through 511.

File Affected

  1. ?

Hierarchy

Tags

Mission

A

Sessions

License

Copyright Kabuki Starship; all rights reserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions