Debian Codegraph @

crypto/bigint/types.ha

raw
1 // SPDX-License-Identifier: MPL-2.0
2 // (c) Hare authors <https://harelang.org>
3
4 // A big integer is stored in an array of words. The first word holds
5 // information about the effective size of the big integer. The subsequend
6 // words encode the value in little-endian order. The [[WORD_BITMASK]] masks the
7 // bits that are actually used to store the value in each word.
8 export type word = u32;
9
10 // Number of bits that are used for storing the value in a word.
11 export def WORD_BITSZ: u32 = 31;
12
13 // Bitmask for bits that are used for storing the value in a word.
14 export def WORD_BITMASK: word = 0x7fffffff;
15
16 // full_bitlen(word) == 1 << WORD_SHIFT
17 def WORD_SHIFT: u32 = 5;