Skip to content

Digram Serialization

F. Conrads edited this page Sep 10, 2019 · 27 revisions

digram-ser.png

To serialize several Digrams we simply add the serialized Digrams to each other, due to the fact that we know the size of the internal data of each digram, hence er know when one Digram ends and when one begins.

External Index

An external index has basically 4 bits, we do need only 3 exploiting the fact that we only have 1 or 2 external indexes The indexes are one of [1,2,3,4] which can be represented as:

  • 1: 001
  • 2: 010
  • 3: 011
  • 4: 100

In the case that we only have one external Index, external Index 2 will be set to 0.

Improvment

  • Use the fact that positive Integers start with a 0 bit. We could simply set the first bit of external Index1 to 1 as we only need 3 bits per external Index. Thus using a xor we can check if we got another internal index integer or the external indexes. This would save 4 bytes * |Digrams|
  • Further on we could save several digrams sorted, thus only needing to save labels once
Clone this wiki locally