teptris 0.2.37-aarch64-linux → 0.2.39-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/teptris_ext/engine/LICENSE.md +21 -0
- data/ext/teptris_ext/engine/src/include/teptris/plan.h +123 -0
- data/ext/teptris_ext/engine/src/include/teptris/teptris.h +208 -0
- data/ext/teptris_ext/engine/src/include/teptris/version.h +9 -0
- data/ext/teptris_ext/engine/src/teptris/api.c +362 -0
- data/ext/teptris_ext/engine/src/teptris/build.c +355 -0
- data/ext/teptris_ext/engine/src/teptris/common/chartype.c +70 -0
- data/ext/teptris_ext/engine/src/teptris/common/chartype.h +41 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/common.h +114 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/d2s.c +496 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/d2s_full_table.h +367 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/d2s_intrinsics.h +357 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/digit_table.h +35 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/ryu_d2s.h +39 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/ryu_parse.h +45 -0
- data/ext/teptris_ext/engine/src/teptris/common/ryu/s2d.c +259 -0
- data/ext/teptris_ext/engine/src/teptris/common/simd.h +119 -0
- data/ext/teptris_ext/engine/src/teptris/dom/dom.c +192 -0
- data/ext/teptris_ext/engine/src/teptris/dom/dom.h +124 -0
- data/ext/teptris_ext/engine/src/teptris/emit/emitter.c +718 -0
- data/ext/teptris_ext/engine/src/teptris/emit/emitter.h +11 -0
- data/ext/teptris_ext/engine/src/teptris/memory/arena.c +104 -0
- data/ext/teptris_ext/engine/src/teptris/memory/arena.h +53 -0
- data/ext/teptris_ext/engine/src/teptris/parse/datetime.c +218 -0
- data/ext/teptris_ext/engine/src/teptris/parse/keys.c +121 -0
- data/ext/teptris_ext/engine/src/teptris/parse/parse.h +76 -0
- data/ext/teptris_ext/engine/src/teptris/parse/parser.c +931 -0
- data/ext/teptris_ext/engine/src/teptris/parse/scalars.c +940 -0
- data/ext/teptris_ext/engine/src/teptris/plan/plan.c +472 -0
- data/ext/teptris_ext/engine/src/teptris/version.c +6 -0
- data/ext/teptris_ext/extconf.rb +61 -0
- data/ext/teptris_ext/materialize.c +608 -0
- data/lib/{teptris_ext.so → teptris/3.3/teptris_ext.so} +0 -0
- data/lib/teptris/3.4/teptris_ext.so +0 -0
- data/lib/teptris/4.0/teptris_ext.so +0 -0
- data/lib/teptris/version.rb +1 -1
- data/lib/teptris.rb +19 -11
- metadata +37 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#include "teptris/common/chartype.h"
|
|
2
|
+
|
|
3
|
+
const uint8_t tep_chartype_table[256] = {
|
|
4
|
+
['0'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
5
|
+
['1'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
6
|
+
['2'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
7
|
+
['3'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
8
|
+
['4'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
9
|
+
['5'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
10
|
+
['6'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
11
|
+
['7'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
12
|
+
['8'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
13
|
+
['9'] = TEP_CT_BAREKEY | TEP_CT_DEC | TEP_CT_HEX,
|
|
14
|
+
['a'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
15
|
+
['b'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
16
|
+
['c'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
17
|
+
['d'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
18
|
+
['e'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
19
|
+
['f'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
20
|
+
['g'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
21
|
+
['h'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
22
|
+
['i'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
23
|
+
['j'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
24
|
+
['k'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
25
|
+
['l'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
26
|
+
['m'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
27
|
+
['n'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
28
|
+
['o'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
29
|
+
['p'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
30
|
+
['q'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
31
|
+
['r'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
32
|
+
['s'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
33
|
+
['t'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
34
|
+
['u'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
35
|
+
['v'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
36
|
+
['w'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
37
|
+
['x'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
38
|
+
['y'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
39
|
+
['z'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
40
|
+
['A'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
41
|
+
['B'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
42
|
+
['C'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
43
|
+
['D'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
44
|
+
['E'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
45
|
+
['F'] = TEP_CT_BAREKEY | TEP_CT_HEX | TEP_CT_ALPHA,
|
|
46
|
+
['G'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
47
|
+
['H'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
48
|
+
['I'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
49
|
+
['J'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
50
|
+
['K'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
51
|
+
['L'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
52
|
+
['M'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
53
|
+
['N'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
54
|
+
['O'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
55
|
+
['P'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
56
|
+
['Q'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
57
|
+
['R'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
58
|
+
['S'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
59
|
+
['T'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
60
|
+
['U'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
61
|
+
['V'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
62
|
+
['W'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
63
|
+
['X'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
64
|
+
['Y'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
65
|
+
['Z'] = TEP_CT_BAREKEY | TEP_CT_ALPHA,
|
|
66
|
+
['_'] = TEP_CT_BAREKEY,
|
|
67
|
+
['-'] = TEP_CT_BAREKEY,
|
|
68
|
+
[' '] = TEP_CT_WS,
|
|
69
|
+
['\t'] = TEP_CT_WS,
|
|
70
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#ifndef TEPTRIS_CHARTYPE_H
|
|
2
|
+
#define TEPTRIS_CHARTYPE_H
|
|
3
|
+
|
|
4
|
+
#include <stdbool.h>
|
|
5
|
+
#include <stdint.h>
|
|
6
|
+
|
|
7
|
+
/* Declared-once truth tables (MECE: the parser never calls is* directly). */
|
|
8
|
+
#define TEP_CT_BAREKEY 0x01u /* [A-Za-z0-9_-] */
|
|
9
|
+
#define TEP_CT_WS 0x02u /* space, tab */
|
|
10
|
+
#define TEP_CT_DEC 0x04u /* [0-9] */
|
|
11
|
+
#define TEP_CT_HEX 0x08u /* [0-9a-fA-F] */
|
|
12
|
+
#define TEP_CT_ALPHA 0x10u /* [A-Za-z] */
|
|
13
|
+
|
|
14
|
+
extern const uint8_t tep_chartype_table[256];
|
|
15
|
+
|
|
16
|
+
static inline bool tep_ct_has(unsigned char c, uint8_t flags)
|
|
17
|
+
{
|
|
18
|
+
return (tep_chartype_table[c] & flags) != 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static inline bool tep_is_barekey(unsigned char c)
|
|
22
|
+
{
|
|
23
|
+
return tep_ct_has(c, TEP_CT_BAREKEY);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static inline bool tep_is_ws(unsigned char c)
|
|
27
|
+
{
|
|
28
|
+
return tep_ct_has(c, TEP_CT_WS);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static inline bool tep_is_dec(unsigned char c)
|
|
32
|
+
{
|
|
33
|
+
return tep_ct_has(c, TEP_CT_DEC);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static inline bool tep_is_hex(unsigned char c)
|
|
37
|
+
{
|
|
38
|
+
return tep_ct_has(c, TEP_CT_HEX);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#endif /* TEPTRIS_CHARTYPE_H */
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Copyright 2018 Ulf Adams
|
|
2
|
+
//
|
|
3
|
+
// The contents of this file may be used under the terms of the Apache License,
|
|
4
|
+
// Version 2.0.
|
|
5
|
+
//
|
|
6
|
+
// (See accompanying file LICENSE-Apache or copy at
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0)
|
|
8
|
+
//
|
|
9
|
+
// Alternatively, the contents of this file may be used under the terms of
|
|
10
|
+
// the Boost Software License, Version 1.0.
|
|
11
|
+
// (See accompanying file LICENSE-Boost or copy at
|
|
12
|
+
// https://www.boost.org/LICENSE_1_0.txt)
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, this software
|
|
15
|
+
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
// KIND, either express or implied.
|
|
17
|
+
#ifndef RYU_COMMON_H
|
|
18
|
+
#define RYU_COMMON_H
|
|
19
|
+
|
|
20
|
+
#include <assert.h>
|
|
21
|
+
#include <stdint.h>
|
|
22
|
+
#include <string.h>
|
|
23
|
+
|
|
24
|
+
#if defined(_M_IX86) || defined(_M_ARM)
|
|
25
|
+
#define RYU_32_BIT_PLATFORM
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
// Returns the number of decimal digits in v, which must not contain more than 9 digits.
|
|
29
|
+
static inline uint32_t decimalLength9(const uint32_t v) {
|
|
30
|
+
// Function precondition: v is not a 10-digit number.
|
|
31
|
+
// (f2s: 9 digits are sufficient for round-tripping.)
|
|
32
|
+
// (d2fixed: We print 9-digit blocks.)
|
|
33
|
+
assert(v < 1000000000);
|
|
34
|
+
if (v >= 100000000) { return 9; }
|
|
35
|
+
if (v >= 10000000) { return 8; }
|
|
36
|
+
if (v >= 1000000) { return 7; }
|
|
37
|
+
if (v >= 100000) { return 6; }
|
|
38
|
+
if (v >= 10000) { return 5; }
|
|
39
|
+
if (v >= 1000) { return 4; }
|
|
40
|
+
if (v >= 100) { return 3; }
|
|
41
|
+
if (v >= 10) { return 2; }
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Returns e == 0 ? 1 : [log_2(5^e)]; requires 0 <= e <= 3528.
|
|
46
|
+
static inline int32_t log2pow5(const int32_t e) {
|
|
47
|
+
// This approximation works up to the point that the multiplication overflows at e = 3529.
|
|
48
|
+
// If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater
|
|
49
|
+
// than 2^9297.
|
|
50
|
+
assert(e >= 0);
|
|
51
|
+
assert(e <= 3528);
|
|
52
|
+
return (int32_t) ((((uint32_t) e) * 1217359) >> 19);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 3528.
|
|
56
|
+
static inline int32_t pow5bits(const int32_t e) {
|
|
57
|
+
// This approximation works up to the point that the multiplication overflows at e = 3529.
|
|
58
|
+
// If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater
|
|
59
|
+
// than 2^9297.
|
|
60
|
+
assert(e >= 0);
|
|
61
|
+
assert(e <= 3528);
|
|
62
|
+
return (int32_t) (((((uint32_t) e) * 1217359) >> 19) + 1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 3528.
|
|
66
|
+
static inline int32_t ceil_log2pow5(const int32_t e) {
|
|
67
|
+
return log2pow5(e) + 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Returns floor(log_10(2^e)); requires 0 <= e <= 1650.
|
|
71
|
+
static inline uint32_t log10Pow2(const int32_t e) {
|
|
72
|
+
// The first value this approximation fails for is 2^1651 which is just greater than 10^297.
|
|
73
|
+
assert(e >= 0);
|
|
74
|
+
assert(e <= 1650);
|
|
75
|
+
return (((uint32_t) e) * 78913) >> 18;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Returns floor(log_10(5^e)); requires 0 <= e <= 2620.
|
|
79
|
+
static inline uint32_t log10Pow5(const int32_t e) {
|
|
80
|
+
// The first value this approximation fails for is 5^2621 which is just greater than 10^1832.
|
|
81
|
+
assert(e >= 0);
|
|
82
|
+
assert(e <= 2620);
|
|
83
|
+
return (((uint32_t) e) * 732923) >> 20;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static inline int copy_special_str(char * const result, const bool sign, const bool exponent, const bool mantissa) {
|
|
87
|
+
if (mantissa) {
|
|
88
|
+
memcpy(result, "NaN", 3);
|
|
89
|
+
return 3;
|
|
90
|
+
}
|
|
91
|
+
if (sign) {
|
|
92
|
+
result[0] = '-';
|
|
93
|
+
}
|
|
94
|
+
if (exponent) {
|
|
95
|
+
memcpy(result + sign, "Infinity", 8);
|
|
96
|
+
return sign + 8;
|
|
97
|
+
}
|
|
98
|
+
memcpy(result + sign, "0E0", 3);
|
|
99
|
+
return sign + 3;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static inline uint32_t float_to_bits(const float f) {
|
|
103
|
+
uint32_t bits = 0;
|
|
104
|
+
memcpy(&bits, &f, sizeof(float));
|
|
105
|
+
return bits;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static inline uint64_t double_to_bits(const double d) {
|
|
109
|
+
uint64_t bits = 0;
|
|
110
|
+
memcpy(&bits, &d, sizeof(double));
|
|
111
|
+
return bits;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#endif // RYU_COMMON_H
|