• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! Pre-computed small tables for parsing decimal strings.
2 
3 #![doc(hidden)]
4 #![cfg(not(feature = "compact"))]
5 
6 /// Pre-computed, small powers-of-5.
7 pub const SMALL_INT_POW5: [u64; 28] = [
8     1,
9     5,
10     25,
11     125,
12     625,
13     3125,
14     15625,
15     78125,
16     390625,
17     1953125,
18     9765625,
19     48828125,
20     244140625,
21     1220703125,
22     6103515625,
23     30517578125,
24     152587890625,
25     762939453125,
26     3814697265625,
27     19073486328125,
28     95367431640625,
29     476837158203125,
30     2384185791015625,
31     11920928955078125,
32     59604644775390625,
33     298023223876953125,
34     1490116119384765625,
35     7450580596923828125,
36 ];
37 
38 /// Pre-computed, small powers-of-10.
39 pub const SMALL_INT_POW10: [u64; 20] = [
40     1,
41     10,
42     100,
43     1000,
44     10000,
45     100000,
46     1000000,
47     10000000,
48     100000000,
49     1000000000,
50     10000000000,
51     100000000000,
52     1000000000000,
53     10000000000000,
54     100000000000000,
55     1000000000000000,
56     10000000000000000,
57     100000000000000000,
58     1000000000000000000,
59     10000000000000000000,
60 ];
61 
62 /// Pre-computed, small powers-of-10.
63 pub const SMALL_F32_POW10: [f32; 16] =
64     [1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 0., 0., 0., 0., 0.];
65 
66 /// Pre-computed, small powers-of-10.
67 pub const SMALL_F64_POW10: [f64; 32] = [
68     1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16,
69     1e17, 1e18, 1e19, 1e20, 1e21, 1e22, 0., 0., 0., 0., 0., 0., 0., 0., 0.,
70 ];
71 
72 /// Pre-computed large power-of-5 for 32-bit limbs.
73 #[cfg(not(all(target_pointer_width = "64", not(target_arch = "sparc"))))]
74 pub const LARGE_POW5: [u32; 10] = [
75     4279965485, 329373468, 4020270615, 2137533757, 4287402176, 1057042919, 1071430142, 2440757623,
76     381945767, 46164893,
77 ];
78 
79 /// Pre-computed large power-of-5 for 64-bit limbs.
80 #[cfg(all(target_pointer_width = "64", not(target_arch = "sparc")))]
81 pub const LARGE_POW5: [u64; 5] = [
82     1414648277510068013,
83     9180637584431281687,
84     4539964771860779200,
85     10482974169319127550,
86     198276706040285095,
87 ];
88 
89 /// Step for large power-of-5 for 32-bit limbs.
90 pub const LARGE_POW5_STEP: u32 = 135;
91