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
64
65
66
67
68
69
70
71
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
//! Conversion between an integer child at a fixed dtype and the narrower array that is stored.
//!
//! Most encodings accept an integer child of any width, and they need nothing from this module.
//! Some encodings fix the dtype of an integer child. For example, the most significant part of a
//! `DecimalByteParts` array has a dtype that follows from the decimal precision. Such an encoding
//! can still store the child at a narrower width, and hold it in memory as a [`WidenArray`] at the
//! fixed dtype.
//!
//! The reader and the writer of such an encoding need the same two steps:
//! [`WidenArray::from_stored_integer`] on read and [`WidenArray::to_stored_integer`] on write.
//! This module owns both steps, so that an encoding does not repeat the requirements of a `Widen`.
//! Neither step reads a value. The encoding still owns how it records the stored dtype, and how it
//! reads a child that is stored wider than the fixed dtype.
use VortexResult;
use vortex_ensure;
use crateArrayRef;
use crateWiden;
use crateWidenArray;
use crateWidenArraySlotsExt;
use cratewrap_values;
use crateDType;