Skip to main content

decode_number

Function decode_number 

Source
fn decode_number(word: &str) -> Option<u64>
Expand description

Decodes a base64-like encoded number from the StarDict/dictd .index format.

.index files encode byte offsets and sizes as base-64 positional numbers rather than plain integers. Each character encodes 6 bits:

CharactersValues
AZ0–25
az26–51
0952–61
+62
/63

The decoded u64 is a byte position (offset) or length (size) that the dictionary reader uses to seek() directly to the right location in the dictionary data file.

Returns None if any character falls outside the encoding alphabet.