Mod9Constants
in package
Mini-class (so not own file) used to hold encode decode info related to Mod9 encoding (as variant of Simplified-9 specify to Yioop).
Mod9 is used to incode a sequence of positive (greater than 0) integers as a string. WARNING: do not expect is to work/decode correctly if sequence has a 0 as the decoding process assumes 0 indicates end of sequence.
Tags
Table of Contents
- $MOD9_NUM_BITS_CODES : mixed
- Keys of this array are prefix codes from the high order byte of a word encoded using Modified 9, values are the number of bits used to encode an element if that prefix code was used.
- $MOD9_NUM_ELTS_CODES : mixed
- Used in Modified 9 encoding. Key values are the number of elements we would like to store in the current word. Values are the bit prefix to use on first byte of word. Notices bits 7 and 6 (128 and 64) are not parts of prefixes as used for continuation bits.
- $MOD9_NUM_ELTS_DECODES : mixed
- Keys of this array are prefix codes from the high order byte of a word encoded using Modified 9, values are the number of elts stored in the remaining bits of the word
- $MOD9_PACK_POSSIBILITIES : mixed
- Used in Modified 9 encoding. The ith array entry represents the number of i bit elements that can be stored in a word using modified 9 (0th index location is a dummy value 0 as can't store 0 bit numbers)
Properties
$MOD9_NUM_BITS_CODES
Keys of this array are prefix codes from the high order byte of a word encoded using Modified 9, values are the number of bits used to encode an element if that prefix code was used.
public
static mixed
$MOD9_NUM_BITS_CODES
= [63 => 1, 62 => 2, 60 => 3, 56 => 4, 52 => 5, 48 => 6, 32 => 9, 16 => 14, 0 => 28]
Tags
$MOD9_NUM_ELTS_CODES
Used in Modified 9 encoding. Key values are the number of elements we would like to store in the current word. Values are the bit prefix to use on first byte of word. Notices bits 7 and 6 (128 and 64) are not parts of prefixes as used for continuation bits.
public
static mixed
$MOD9_NUM_ELTS_CODES
= [24 => 63, 12 => 62, 7 => 60, 6 => 56, 5 => 52, 4 => 48, 3 => 32, 2 => 16, 1 => 0]
Tags
$MOD9_NUM_ELTS_DECODES
Keys of this array are prefix codes from the high order byte of a word encoded using Modified 9, values are the number of elts stored in the remaining bits of the word
public
static mixed
$MOD9_NUM_ELTS_DECODES
= [63 => 24, 62 => 12, 60 => 7, 56 => 6, 52 => 5, 48 => 4, 32 => 3, 16 => 2, 0 => 1]
Tags
$MOD9_PACK_POSSIBILITIES
Used in Modified 9 encoding. The ith array entry represents the number of i bit elements that can be stored in a word using modified 9 (0th index location is a dummy value 0 as can't store 0 bit numbers)
public
static mixed
$MOD9_PACK_POSSIBILITIES
= [0, 24, 12, 7, 6, 5, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]