1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Copyright (c) 2025-2026 Anton Kundenko <singaraiona@gmail.com>
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* FSST string compression (Boncz, Neumann, Leis, VLDB 2020): a table of at
* most 255 symbols of 1..8 bytes; code c < n expands to symbol c, code 255
* escapes one literal byte. Each string is compressed on its own. */
typedef struct ray_fsst_table_t;
/* Compact encode index (~0.5 KB): symbols grouped by first byte, longest first. */
typedef struct ray_fsst_index_s ray_fsst_index_t;
void ;
/* out must hold 2*len bytes (worst case: every byte escaped). */
int64_t ;
/* Trains *t on the strings (sampled to 256 KiB). Returns 1 = trained
* (t->n > 0), 0 = no table (no string bytes or no candidate; t->n == 0),
* -1 = out of memory (t->n == 0). A caller whose output must not depend
* on memory pressure fails on -1. */
int ;
/* out must hold 2*len bytes. Builds an index per call; use ray_fsst_encode_ix in loops. */
int64_t ;
/* Expand the codes in[0, len) of a string ray_fsst_encode wrote: out
* receives ray_fsst_expanded_len bytes; returns that length. */
int64_t ;
/* ray_fsst_decode copying each symbol as a whole 8-byte word: out must
* hold 8 bytes past the expanded length. */
int64_t ;
int64_t ;
int64_t ;