l0n0lc 0.9.1__tar.gz → 0.9.3__tar.gz
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.
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/PKG-INFO +68 -68
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/README.md +67 -67
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc/StdMap.py +1 -2
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc/jit.py +28 -25
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc.egg-info/PKG-INFO +68 -68
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/pyproject.toml +1 -1
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/LICENSE +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc/StdList.py +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc/__init__.py +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc/c/345/237/272/347/241/200/345/244/204/347/220/206.py" +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc//347/274/226/350/257/221.py" +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc//351/200/232/347/224/250.py" +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc.egg-info/SOURCES.txt +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc.egg-info/dependency_links.txt +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/l0n0lc.egg-info/top_level.txt +0 -0
- {l0n0lc-0.9.1 → l0n0lc-0.9.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.3
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -69,7 +69,7 @@ class CppVectorInt:
|
|
69
69
|
return 0
|
70
70
|
|
71
71
|
|
72
|
-
@lc.jit()
|
72
|
+
@lc.jit(每次运行都重新编译=True)
|
73
73
|
def jit_all_ops(a: int, b: int) -> int:
|
74
74
|
# 常量与基础赋值
|
75
75
|
x = 42
|
@@ -81,7 +81,7 @@ def jit_all_ops(a: int, b: int) -> int:
|
|
81
81
|
mp = {1: 10, 2: 20}
|
82
82
|
|
83
83
|
# 一元运算
|
84
|
-
pos = +a
|
84
|
+
pos = +(a + 1)
|
85
85
|
neg = -b
|
86
86
|
inv = ~a
|
87
87
|
not_flag = not flag
|
@@ -162,7 +162,7 @@ def jit_all_ops(a: int, b: int) -> int:
|
|
162
162
|
@lc.jit(每次运行都重新编译=True)
|
163
163
|
def test_add(a: int, b: int) -> int:
|
164
164
|
if a > 1:
|
165
|
-
return a + b
|
165
|
+
return (a + b) * 123123
|
166
166
|
for i in range(1, 10, 2):
|
167
167
|
a += i
|
168
168
|
for i in [1, 2, 3]:
|
@@ -189,7 +189,7 @@ def test_add(a: int, b: int) -> int:
|
|
189
189
|
vv = True and (False or 1)
|
190
190
|
print('vv:', vv)
|
191
191
|
print('测试while:')
|
192
|
-
while
|
192
|
+
while vv:
|
193
193
|
py_cin(v)
|
194
194
|
if v > 100:
|
195
195
|
break
|
@@ -235,75 +235,75 @@ vv: 1
|
|
235
235
|
```bash
|
236
236
|
ls -al ./l0n0lcoutput
|
237
237
|
total 136
|
238
|
-
drwxr-xr-x 2 root root 4096 Sep 18
|
239
|
-
drwxrwxrwx 11 1000 1000 4096 Sep 18
|
240
|
-
-rw-r--r-- 1 root root
|
241
|
-
-rw-r--r-- 1 root root 167 Sep 18
|
242
|
-
-rwxr-xr-x 1 root root 23520 Sep 18
|
243
|
-
-rw-r--r-- 1 root root
|
244
|
-
-rw-r--r-- 1 root root 302 Sep 18
|
245
|
-
-rwxr-xr-x 1 root root 40216 Sep 18
|
246
|
-
-rw-r--r-- 1 root root
|
247
|
-
-rw-r--r-- 1 root root 106 Sep 18
|
248
|
-
-rwxr-xr-x 1 root root 15616 Sep 18
|
249
|
-
-rw-r--r-- 1 root root
|
250
|
-
-rw-r--r-- 1 root root 164 Sep 18
|
251
|
-
-rwxr-xr-x 1 root root 15656 Sep 18
|
238
|
+
drwxr-xr-x 2 root root 4096 Sep 18 02:00 .
|
239
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 18 02:00 ..
|
240
|
+
-rw-r--r-- 1 root root 1779 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.cpp
|
241
|
+
-rw-r--r-- 1 root root 167 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.h
|
242
|
+
-rwxr-xr-x 1 root root 23520 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.so
|
243
|
+
-rw-r--r-- 1 root root 1499 Sep 18 02:00 test_add_@469de6acaaabc570.cpp
|
244
|
+
-rw-r--r-- 1 root root 302 Sep 18 02:00 test_add_@469de6acaaabc570.h
|
245
|
+
-rwxr-xr-x 1 root root 40216 Sep 18 02:00 test_add_@469de6acaaabc570.so
|
246
|
+
-rw-r--r-- 1 root root 123 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.cpp
|
247
|
+
-rw-r--r-- 1 root root 106 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.h
|
248
|
+
-rwxr-xr-x 1 root root 15616 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.so
|
249
|
+
-rw-r--r-- 1 root root 187 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.cpp
|
250
|
+
-rw-r--r-- 1 root root 164 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.h
|
251
|
+
-rwxr-xr-x 1 root root 15656 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.so
|
252
252
|
|
253
253
|
```
|
254
|
-
## 5. jit_all_ops_@
|
254
|
+
## 5. jit_all_ops_@7801528c3d61baf7.cpp
|
255
255
|
```c++
|
256
|
-
#include "jit_all_ops_@
|
256
|
+
#include "jit_all_ops_@7801528c3d61baf7.h"
|
257
257
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
258
258
|
{
|
259
259
|
auto x = 42;
|
260
|
-
auto y = ((int64_t)(a + b));
|
260
|
+
auto y = ((int64_t)((a + b)));
|
261
261
|
auto z = 3.14;
|
262
262
|
auto flag = true;
|
263
263
|
int64_t nums[] = {1,2,3};
|
264
264
|
int64_t tup[] = {4,5};
|
265
265
|
std::unordered_map<int64_t, int64_t> mp = {{ 1, 10 },{ 2, 20 }};
|
266
|
-
auto pos = +a;
|
267
|
-
auto neg = -b;
|
268
|
-
auto inv = ~a;
|
269
|
-
auto not_flag = !flag;
|
270
|
-
auto add = a + b;
|
271
|
-
auto sub = a - b;
|
272
|
-
auto mul = a * b;
|
273
|
-
auto div = a / ((b != 0) ? (b) : (1));
|
274
|
-
auto mod = a % ((b != 0) ? (b) : (1));
|
275
|
-
auto band = a & b;
|
276
|
-
auto bor = a | b;
|
277
|
-
auto bxor = a ^ b;
|
278
|
-
auto lshift = a << 1;
|
279
|
-
auto rshift = a >> 1;
|
266
|
+
auto pos = (+(a + 1));
|
267
|
+
auto neg = (-b);
|
268
|
+
auto inv = (~a);
|
269
|
+
auto not_flag = (!flag);
|
270
|
+
auto add = (a + b);
|
271
|
+
auto sub = (a - b);
|
272
|
+
auto mul = (a * b);
|
273
|
+
auto div = (a / (((b != 0)) ? (b) : (1)));
|
274
|
+
auto mod = (a % (((b != 0)) ? (b) : (1)));
|
275
|
+
auto band = (a & b);
|
276
|
+
auto bor = (a | b);
|
277
|
+
auto bxor = (a ^ b);
|
278
|
+
auto lshift = (a << 1);
|
279
|
+
auto rshift = (a >> 1);
|
280
280
|
auto cmp1 = (a == b);
|
281
281
|
auto cmp2 = (a != b);
|
282
282
|
auto cmp3 = (a < b);
|
283
283
|
auto cmp4 = (a <= b);
|
284
284
|
auto cmp5 = (a > b);
|
285
285
|
auto cmp6 = (a >= b);
|
286
|
-
auto logic_and = cmp1&&cmp2;
|
287
|
-
auto logic_or = cmp3||cmp4;
|
288
|
-
auto ternary = ((a > b) ? (a) : (b));
|
286
|
+
auto logic_and = (cmp1)&&(cmp2);
|
287
|
+
auto logic_or = (cmp3)||(cmp4);
|
288
|
+
auto ternary = (((a > b)) ? (a) : (b));
|
289
289
|
if ((a > b))
|
290
290
|
{
|
291
|
-
y = y + 1;
|
291
|
+
y = (y + 1);
|
292
292
|
}
|
293
293
|
|
294
294
|
else
|
295
295
|
{
|
296
|
-
y = y - 1;
|
296
|
+
y = (y - 1);
|
297
297
|
}
|
298
298
|
|
299
299
|
for (int64_t i = 0; i < 3; ++i)
|
300
300
|
{
|
301
|
-
y = y + i;
|
301
|
+
y = (y + i);
|
302
302
|
}
|
303
303
|
|
304
304
|
for (auto v : nums)
|
305
305
|
{
|
306
|
-
y = y + v;
|
306
|
+
y = (y + v);
|
307
307
|
if ((v == 2))
|
308
308
|
{
|
309
309
|
continue;
|
@@ -319,23 +319,23 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
319
319
|
auto count = 0;
|
320
320
|
while ((count < 2))
|
321
321
|
{
|
322
|
-
y = y + count;
|
323
|
-
count = count + 1;
|
322
|
+
y = (y + count);
|
323
|
+
count = (count + 1);
|
324
324
|
}
|
325
325
|
|
326
|
-
y = y + 5;
|
327
|
-
y = y - 1;
|
328
|
-
y = y * 2;
|
329
|
-
y = y / 2;
|
330
|
-
y = y % 10;
|
331
|
-
y = y & 7;
|
332
|
-
y = y | 3;
|
333
|
-
y = y ^ 1;
|
334
|
-
y = y << 1;
|
335
|
-
y = y >> 1;
|
326
|
+
y = (y + 5);
|
327
|
+
y = (y - 1);
|
328
|
+
y = (y * 2);
|
329
|
+
y = (y / 2);
|
330
|
+
y = (y % 10);
|
331
|
+
y = (y & 7);
|
332
|
+
y = (y | 3);
|
333
|
+
y = (y ^ 1);
|
334
|
+
y = (y << 1);
|
335
|
+
y = (y >> 1);
|
336
336
|
auto first_num = nums[0];
|
337
337
|
auto mp_val = mp[1];
|
338
|
-
y = y + first_num + mp_val;
|
338
|
+
y = (y + (first_num + mp_val));
|
339
339
|
auto vector = std::vector<int>();
|
340
340
|
vector.push_back(count);
|
341
341
|
vector.push_back(y);
|
@@ -348,7 +348,7 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
348
348
|
}
|
349
349
|
|
350
350
|
```
|
351
|
-
## 6. jit_all_ops_@
|
351
|
+
## 6. jit_all_ops_@7801528c3d61baf7.h
|
352
352
|
```c++
|
353
353
|
#pragma once
|
354
354
|
#include <cstdint>
|
@@ -358,24 +358,24 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
358
358
|
#include <vector>
|
359
359
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b);
|
360
360
|
```
|
361
|
-
## 7. test_add_@
|
361
|
+
## 7. test_add_@469de6acaaabc570.cpp
|
362
362
|
```c++
|
363
|
-
#include "test_add_@
|
363
|
+
#include "test_add_@469de6acaaabc570.h"
|
364
364
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
365
365
|
{
|
366
366
|
if ((a > 1))
|
367
367
|
{
|
368
|
-
return a + b;
|
368
|
+
return ((a + b) * 123123);
|
369
369
|
}
|
370
370
|
|
371
371
|
for (int64_t i = 1; i < 10; i += 2)
|
372
372
|
{
|
373
|
-
a = a + i;
|
373
|
+
a = (a + i);
|
374
374
|
}
|
375
375
|
|
376
376
|
for (auto i : {1,2,3})
|
377
377
|
{
|
378
|
-
a = a + i;
|
378
|
+
a = (a + i);
|
379
379
|
}
|
380
380
|
|
381
381
|
a = std::ceil(12.5);;
|
@@ -401,7 +401,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
401
401
|
std::cout<< u8"测试所有操作:" << " "<< std::endl;;
|
402
402
|
jit_all_ops(a,b);
|
403
403
|
auto v = 0;
|
404
|
-
auto vv = true&&false||1;
|
404
|
+
auto vv = (true)&&((false)||(1));
|
405
405
|
std::cout<< u8"vv:" << " "<< vv << " "<< std::endl;;
|
406
406
|
std::cout<< u8"测试while:" << " "<< std::endl;;
|
407
407
|
while (vv)
|
@@ -419,14 +419,14 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
419
419
|
|
420
420
|
}
|
421
421
|
|
422
|
-
return a + b + 1 + 123 + v;
|
422
|
+
return ((((a + b) + 1) + 123) + v);
|
423
423
|
}
|
424
424
|
|
425
425
|
```
|
426
|
-
## 8. test_add_@
|
426
|
+
## 8. test_add_@469de6acaaabc570.h
|
427
427
|
```c++
|
428
428
|
#pragma once
|
429
|
-
#include "jit_all_ops_@
|
429
|
+
#include "jit_all_ops_@7801528c3d61baf7.h"
|
430
430
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
431
431
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
432
432
|
#include <cmath>
|
@@ -441,7 +441,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b);
|
|
441
441
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
442
442
|
extern "C" int64_t test_other_fn (int64_t a, int64_t b)
|
443
443
|
{
|
444
|
-
return a - b;
|
444
|
+
return (a - b);
|
445
445
|
}
|
446
446
|
|
447
447
|
```
|
@@ -457,7 +457,7 @@ extern "C" int64_t test_other_fn (int64_t a, int64_t b);
|
|
457
457
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
458
458
|
extern "C" int64_t /*test编译的函数*/ function_74657374e7bc96e8af91e79a84e587bde695b0 (int64_t a, int64_t b)
|
459
459
|
{
|
460
|
-
return a * b;
|
460
|
+
return (a * b);
|
461
461
|
}
|
462
462
|
|
463
463
|
```
|
@@ -59,7 +59,7 @@ class CppVectorInt:
|
|
59
59
|
return 0
|
60
60
|
|
61
61
|
|
62
|
-
@lc.jit()
|
62
|
+
@lc.jit(每次运行都重新编译=True)
|
63
63
|
def jit_all_ops(a: int, b: int) -> int:
|
64
64
|
# 常量与基础赋值
|
65
65
|
x = 42
|
@@ -71,7 +71,7 @@ def jit_all_ops(a: int, b: int) -> int:
|
|
71
71
|
mp = {1: 10, 2: 20}
|
72
72
|
|
73
73
|
# 一元运算
|
74
|
-
pos = +a
|
74
|
+
pos = +(a + 1)
|
75
75
|
neg = -b
|
76
76
|
inv = ~a
|
77
77
|
not_flag = not flag
|
@@ -152,7 +152,7 @@ def jit_all_ops(a: int, b: int) -> int:
|
|
152
152
|
@lc.jit(每次运行都重新编译=True)
|
153
153
|
def test_add(a: int, b: int) -> int:
|
154
154
|
if a > 1:
|
155
|
-
return a + b
|
155
|
+
return (a + b) * 123123
|
156
156
|
for i in range(1, 10, 2):
|
157
157
|
a += i
|
158
158
|
for i in [1, 2, 3]:
|
@@ -179,7 +179,7 @@ def test_add(a: int, b: int) -> int:
|
|
179
179
|
vv = True and (False or 1)
|
180
180
|
print('vv:', vv)
|
181
181
|
print('测试while:')
|
182
|
-
while
|
182
|
+
while vv:
|
183
183
|
py_cin(v)
|
184
184
|
if v > 100:
|
185
185
|
break
|
@@ -225,75 +225,75 @@ vv: 1
|
|
225
225
|
```bash
|
226
226
|
ls -al ./l0n0lcoutput
|
227
227
|
total 136
|
228
|
-
drwxr-xr-x 2 root root 4096 Sep 18
|
229
|
-
drwxrwxrwx 11 1000 1000 4096 Sep 18
|
230
|
-
-rw-r--r-- 1 root root
|
231
|
-
-rw-r--r-- 1 root root 167 Sep 18
|
232
|
-
-rwxr-xr-x 1 root root 23520 Sep 18
|
233
|
-
-rw-r--r-- 1 root root
|
234
|
-
-rw-r--r-- 1 root root 302 Sep 18
|
235
|
-
-rwxr-xr-x 1 root root 40216 Sep 18
|
236
|
-
-rw-r--r-- 1 root root
|
237
|
-
-rw-r--r-- 1 root root 106 Sep 18
|
238
|
-
-rwxr-xr-x 1 root root 15616 Sep 18
|
239
|
-
-rw-r--r-- 1 root root
|
240
|
-
-rw-r--r-- 1 root root 164 Sep 18
|
241
|
-
-rwxr-xr-x 1 root root 15656 Sep 18
|
228
|
+
drwxr-xr-x 2 root root 4096 Sep 18 02:00 .
|
229
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 18 02:00 ..
|
230
|
+
-rw-r--r-- 1 root root 1779 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.cpp
|
231
|
+
-rw-r--r-- 1 root root 167 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.h
|
232
|
+
-rwxr-xr-x 1 root root 23520 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.so
|
233
|
+
-rw-r--r-- 1 root root 1499 Sep 18 02:00 test_add_@469de6acaaabc570.cpp
|
234
|
+
-rw-r--r-- 1 root root 302 Sep 18 02:00 test_add_@469de6acaaabc570.h
|
235
|
+
-rwxr-xr-x 1 root root 40216 Sep 18 02:00 test_add_@469de6acaaabc570.so
|
236
|
+
-rw-r--r-- 1 root root 123 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.cpp
|
237
|
+
-rw-r--r-- 1 root root 106 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.h
|
238
|
+
-rwxr-xr-x 1 root root 15616 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.so
|
239
|
+
-rw-r--r-- 1 root root 187 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.cpp
|
240
|
+
-rw-r--r-- 1 root root 164 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.h
|
241
|
+
-rwxr-xr-x 1 root root 15656 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.so
|
242
242
|
|
243
243
|
```
|
244
|
-
## 5. jit_all_ops_@
|
244
|
+
## 5. jit_all_ops_@7801528c3d61baf7.cpp
|
245
245
|
```c++
|
246
|
-
#include "jit_all_ops_@
|
246
|
+
#include "jit_all_ops_@7801528c3d61baf7.h"
|
247
247
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
248
248
|
{
|
249
249
|
auto x = 42;
|
250
|
-
auto y = ((int64_t)(a + b));
|
250
|
+
auto y = ((int64_t)((a + b)));
|
251
251
|
auto z = 3.14;
|
252
252
|
auto flag = true;
|
253
253
|
int64_t nums[] = {1,2,3};
|
254
254
|
int64_t tup[] = {4,5};
|
255
255
|
std::unordered_map<int64_t, int64_t> mp = {{ 1, 10 },{ 2, 20 }};
|
256
|
-
auto pos = +a;
|
257
|
-
auto neg = -b;
|
258
|
-
auto inv = ~a;
|
259
|
-
auto not_flag = !flag;
|
260
|
-
auto add = a + b;
|
261
|
-
auto sub = a - b;
|
262
|
-
auto mul = a * b;
|
263
|
-
auto div = a / ((b != 0) ? (b) : (1));
|
264
|
-
auto mod = a % ((b != 0) ? (b) : (1));
|
265
|
-
auto band = a & b;
|
266
|
-
auto bor = a | b;
|
267
|
-
auto bxor = a ^ b;
|
268
|
-
auto lshift = a << 1;
|
269
|
-
auto rshift = a >> 1;
|
256
|
+
auto pos = (+(a + 1));
|
257
|
+
auto neg = (-b);
|
258
|
+
auto inv = (~a);
|
259
|
+
auto not_flag = (!flag);
|
260
|
+
auto add = (a + b);
|
261
|
+
auto sub = (a - b);
|
262
|
+
auto mul = (a * b);
|
263
|
+
auto div = (a / (((b != 0)) ? (b) : (1)));
|
264
|
+
auto mod = (a % (((b != 0)) ? (b) : (1)));
|
265
|
+
auto band = (a & b);
|
266
|
+
auto bor = (a | b);
|
267
|
+
auto bxor = (a ^ b);
|
268
|
+
auto lshift = (a << 1);
|
269
|
+
auto rshift = (a >> 1);
|
270
270
|
auto cmp1 = (a == b);
|
271
271
|
auto cmp2 = (a != b);
|
272
272
|
auto cmp3 = (a < b);
|
273
273
|
auto cmp4 = (a <= b);
|
274
274
|
auto cmp5 = (a > b);
|
275
275
|
auto cmp6 = (a >= b);
|
276
|
-
auto logic_and = cmp1&&cmp2;
|
277
|
-
auto logic_or = cmp3||cmp4;
|
278
|
-
auto ternary = ((a > b) ? (a) : (b));
|
276
|
+
auto logic_and = (cmp1)&&(cmp2);
|
277
|
+
auto logic_or = (cmp3)||(cmp4);
|
278
|
+
auto ternary = (((a > b)) ? (a) : (b));
|
279
279
|
if ((a > b))
|
280
280
|
{
|
281
|
-
y = y + 1;
|
281
|
+
y = (y + 1);
|
282
282
|
}
|
283
283
|
|
284
284
|
else
|
285
285
|
{
|
286
|
-
y = y - 1;
|
286
|
+
y = (y - 1);
|
287
287
|
}
|
288
288
|
|
289
289
|
for (int64_t i = 0; i < 3; ++i)
|
290
290
|
{
|
291
|
-
y = y + i;
|
291
|
+
y = (y + i);
|
292
292
|
}
|
293
293
|
|
294
294
|
for (auto v : nums)
|
295
295
|
{
|
296
|
-
y = y + v;
|
296
|
+
y = (y + v);
|
297
297
|
if ((v == 2))
|
298
298
|
{
|
299
299
|
continue;
|
@@ -309,23 +309,23 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
309
309
|
auto count = 0;
|
310
310
|
while ((count < 2))
|
311
311
|
{
|
312
|
-
y = y + count;
|
313
|
-
count = count + 1;
|
312
|
+
y = (y + count);
|
313
|
+
count = (count + 1);
|
314
314
|
}
|
315
315
|
|
316
|
-
y = y + 5;
|
317
|
-
y = y - 1;
|
318
|
-
y = y * 2;
|
319
|
-
y = y / 2;
|
320
|
-
y = y % 10;
|
321
|
-
y = y & 7;
|
322
|
-
y = y | 3;
|
323
|
-
y = y ^ 1;
|
324
|
-
y = y << 1;
|
325
|
-
y = y >> 1;
|
316
|
+
y = (y + 5);
|
317
|
+
y = (y - 1);
|
318
|
+
y = (y * 2);
|
319
|
+
y = (y / 2);
|
320
|
+
y = (y % 10);
|
321
|
+
y = (y & 7);
|
322
|
+
y = (y | 3);
|
323
|
+
y = (y ^ 1);
|
324
|
+
y = (y << 1);
|
325
|
+
y = (y >> 1);
|
326
326
|
auto first_num = nums[0];
|
327
327
|
auto mp_val = mp[1];
|
328
|
-
y = y + first_num + mp_val;
|
328
|
+
y = (y + (first_num + mp_val));
|
329
329
|
auto vector = std::vector<int>();
|
330
330
|
vector.push_back(count);
|
331
331
|
vector.push_back(y);
|
@@ -338,7 +338,7 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
338
338
|
}
|
339
339
|
|
340
340
|
```
|
341
|
-
## 6. jit_all_ops_@
|
341
|
+
## 6. jit_all_ops_@7801528c3d61baf7.h
|
342
342
|
```c++
|
343
343
|
#pragma once
|
344
344
|
#include <cstdint>
|
@@ -348,24 +348,24 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
348
348
|
#include <vector>
|
349
349
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b);
|
350
350
|
```
|
351
|
-
## 7. test_add_@
|
351
|
+
## 7. test_add_@469de6acaaabc570.cpp
|
352
352
|
```c++
|
353
|
-
#include "test_add_@
|
353
|
+
#include "test_add_@469de6acaaabc570.h"
|
354
354
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
355
355
|
{
|
356
356
|
if ((a > 1))
|
357
357
|
{
|
358
|
-
return a + b;
|
358
|
+
return ((a + b) * 123123);
|
359
359
|
}
|
360
360
|
|
361
361
|
for (int64_t i = 1; i < 10; i += 2)
|
362
362
|
{
|
363
|
-
a = a + i;
|
363
|
+
a = (a + i);
|
364
364
|
}
|
365
365
|
|
366
366
|
for (auto i : {1,2,3})
|
367
367
|
{
|
368
|
-
a = a + i;
|
368
|
+
a = (a + i);
|
369
369
|
}
|
370
370
|
|
371
371
|
a = std::ceil(12.5);;
|
@@ -391,7 +391,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
391
391
|
std::cout<< u8"测试所有操作:" << " "<< std::endl;;
|
392
392
|
jit_all_ops(a,b);
|
393
393
|
auto v = 0;
|
394
|
-
auto vv = true&&false||1;
|
394
|
+
auto vv = (true)&&((false)||(1));
|
395
395
|
std::cout<< u8"vv:" << " "<< vv << " "<< std::endl;;
|
396
396
|
std::cout<< u8"测试while:" << " "<< std::endl;;
|
397
397
|
while (vv)
|
@@ -409,14 +409,14 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
409
409
|
|
410
410
|
}
|
411
411
|
|
412
|
-
return a + b + 1 + 123 + v;
|
412
|
+
return ((((a + b) + 1) + 123) + v);
|
413
413
|
}
|
414
414
|
|
415
415
|
```
|
416
|
-
## 8. test_add_@
|
416
|
+
## 8. test_add_@469de6acaaabc570.h
|
417
417
|
```c++
|
418
418
|
#pragma once
|
419
|
-
#include "jit_all_ops_@
|
419
|
+
#include "jit_all_ops_@7801528c3d61baf7.h"
|
420
420
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
421
421
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
422
422
|
#include <cmath>
|
@@ -431,7 +431,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b);
|
|
431
431
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
432
432
|
extern "C" int64_t test_other_fn (int64_t a, int64_t b)
|
433
433
|
{
|
434
|
-
return a - b;
|
434
|
+
return (a - b);
|
435
435
|
}
|
436
436
|
|
437
437
|
```
|
@@ -447,7 +447,7 @@ extern "C" int64_t test_other_fn (int64_t a, int64_t b);
|
|
447
447
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
448
448
|
extern "C" int64_t /*test编译的函数*/ function_74657374e7bc96e8af91e79a84e587bde695b0 (int64_t a, int64_t b)
|
449
449
|
{
|
450
|
-
return a * b;
|
450
|
+
return (a * b);
|
451
451
|
}
|
452
452
|
|
453
453
|
```
|
@@ -198,25 +198,25 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
198
198
|
if isinstance(value, ast.UnaryOp):
|
199
199
|
operand = self.获取值(value.operand)
|
200
200
|
if isinstance(value.op, ast.UAdd):
|
201
|
-
return f'+{operand}'
|
201
|
+
return f'(+{operand})'
|
202
202
|
if isinstance(value.op, ast.USub):
|
203
|
-
return f'-{operand}'
|
203
|
+
return f'(-{operand})'
|
204
204
|
if isinstance(value.op, ast.Not):
|
205
|
-
return f'!{operand}'
|
205
|
+
return f'(!{operand})'
|
206
206
|
if isinstance(value.op, ast.Invert):
|
207
|
-
return f'~{operand}'
|
207
|
+
return f'(~{operand})'
|
208
208
|
|
209
209
|
if isinstance(value, ast.BoolOp):
|
210
210
|
if isinstance(value.op, ast.And):
|
211
|
-
return '&&'.join([
|
211
|
+
return '&&'.join([f'({self.获取值(v)})' for v in value.values])
|
212
212
|
if isinstance(value.op, ast.Or):
|
213
|
-
return '||'.join([
|
213
|
+
return '||'.join([f'({self.获取值(v)})' for v in value.values])
|
214
214
|
|
215
215
|
if isinstance(value, ast.IfExp):
|
216
216
|
test = self.获取值(value.test)
|
217
217
|
body = self.获取值(value.body)
|
218
218
|
orelse = self.获取值(value.orelse)
|
219
|
-
return f'({test} ? ({body}) : ({orelse}))'
|
219
|
+
return f'(({test}) ? ({body}) : ({orelse}))'
|
220
220
|
|
221
221
|
if isinstance(value, ast.Compare):
|
222
222
|
return self.计算Compare(value)
|
@@ -251,19 +251,22 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
251
251
|
left = left if 输出left else ''
|
252
252
|
right = self.获取值(comp)
|
253
253
|
if isinstance(op, ast.Eq):
|
254
|
-
ret += f'{left} == {right}'
|
254
|
+
ret += f'({left} == {right})'
|
255
255
|
if isinstance(op, ast.NotEq):
|
256
|
-
ret += f'{left} != {right}'
|
256
|
+
ret += f'({left} != {right})'
|
257
257
|
if isinstance(op, ast.Lt):
|
258
|
-
ret += f'{left} < {right}'
|
258
|
+
ret += f'({left} < {right})'
|
259
259
|
if isinstance(op, ast.LtE):
|
260
|
-
ret += f'{left} <= {right}'
|
260
|
+
ret += f'({left} <= {right})'
|
261
261
|
if isinstance(op, ast.Gt):
|
262
|
-
ret += f'{left} > {right}'
|
262
|
+
ret += f'({left} > {right})'
|
263
263
|
if isinstance(op, ast.GtE):
|
264
|
-
ret += f'{left} >= {right}'
|
264
|
+
ret += f'({left} >= {right})'
|
265
265
|
left = right
|
266
266
|
输出left = False
|
267
|
+
# 如果只有一项, 不需要多层括号
|
268
|
+
if len(node.ops) == 1:
|
269
|
+
return ret[1:]
|
267
270
|
return ret + ')'
|
268
271
|
|
269
272
|
def 计算二元运算(self, node: ast.BinOp | ast.AugAssign):
|
@@ -275,25 +278,25 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
275
278
|
right = self.获取值(node.value)
|
276
279
|
op = node.op
|
277
280
|
if isinstance(op, ast.Add):
|
278
|
-
return f'{left} + {right}'
|
281
|
+
return f'({left} + {right})'
|
279
282
|
if isinstance(op, ast.Sub):
|
280
|
-
return f'{left} - {right}'
|
283
|
+
return f'({left} - {right})'
|
281
284
|
if isinstance(op, ast.Mult):
|
282
|
-
return f'{left} * {right}'
|
285
|
+
return f'({left} * {right})'
|
283
286
|
if isinstance(op, (ast.Div, ast.FloorDiv)):
|
284
|
-
return f'{left} / {right}'
|
287
|
+
return f'({left} / {right})'
|
285
288
|
if isinstance(op, ast.Mod):
|
286
|
-
return f'{left} % {right}'
|
289
|
+
return f'({left} % {right})'
|
287
290
|
if isinstance(op, ast.BitAnd):
|
288
|
-
return f'{left} & {right}'
|
291
|
+
return f'({left} & {right})'
|
289
292
|
if isinstance(op, ast.BitOr):
|
290
|
-
return f'{left} | {right}'
|
293
|
+
return f'({left} | {right})'
|
291
294
|
if isinstance(op, ast.BitXor):
|
292
|
-
return f'{left} ^ {right}'
|
295
|
+
return f'({left} ^ {right})'
|
293
296
|
if isinstance(op, ast.LShift):
|
294
|
-
return f'{left} << {right}'
|
297
|
+
return f'({left} << {right})'
|
295
298
|
if isinstance(op, ast.RShift):
|
296
|
-
return f'{left} >> {right}'
|
299
|
+
return f'({left} >> {right})'
|
297
300
|
|
298
301
|
self.抛出代码异常(f"暂不支持的运算符: {type(op).__name__}", node)
|
299
302
|
|
@@ -556,10 +559,10 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
556
559
|
值 = self.获取值(node.value)
|
557
560
|
目标类型 = self.获取值(node.annotation)
|
558
561
|
if 目标类型 is None:
|
559
|
-
self.抛出代码异常(f'
|
562
|
+
self.抛出代码异常(f'不支持的类型:{node.annotation}', node)
|
560
563
|
c类型 = py类型转c类型(目标类型)
|
561
564
|
if c类型 is None:
|
562
|
-
self.抛出代码异常(f'
|
565
|
+
self.抛出代码异常(f'不支持的类型:{目标类型}', node)
|
563
566
|
self._赋值(node.target, 值, node, str(c类型))
|
564
567
|
|
565
568
|
def 获取定义(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.3
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -69,7 +69,7 @@ class CppVectorInt:
|
|
69
69
|
return 0
|
70
70
|
|
71
71
|
|
72
|
-
@lc.jit()
|
72
|
+
@lc.jit(每次运行都重新编译=True)
|
73
73
|
def jit_all_ops(a: int, b: int) -> int:
|
74
74
|
# 常量与基础赋值
|
75
75
|
x = 42
|
@@ -81,7 +81,7 @@ def jit_all_ops(a: int, b: int) -> int:
|
|
81
81
|
mp = {1: 10, 2: 20}
|
82
82
|
|
83
83
|
# 一元运算
|
84
|
-
pos = +a
|
84
|
+
pos = +(a + 1)
|
85
85
|
neg = -b
|
86
86
|
inv = ~a
|
87
87
|
not_flag = not flag
|
@@ -162,7 +162,7 @@ def jit_all_ops(a: int, b: int) -> int:
|
|
162
162
|
@lc.jit(每次运行都重新编译=True)
|
163
163
|
def test_add(a: int, b: int) -> int:
|
164
164
|
if a > 1:
|
165
|
-
return a + b
|
165
|
+
return (a + b) * 123123
|
166
166
|
for i in range(1, 10, 2):
|
167
167
|
a += i
|
168
168
|
for i in [1, 2, 3]:
|
@@ -189,7 +189,7 @@ def test_add(a: int, b: int) -> int:
|
|
189
189
|
vv = True and (False or 1)
|
190
190
|
print('vv:', vv)
|
191
191
|
print('测试while:')
|
192
|
-
while
|
192
|
+
while vv:
|
193
193
|
py_cin(v)
|
194
194
|
if v > 100:
|
195
195
|
break
|
@@ -235,75 +235,75 @@ vv: 1
|
|
235
235
|
```bash
|
236
236
|
ls -al ./l0n0lcoutput
|
237
237
|
total 136
|
238
|
-
drwxr-xr-x 2 root root 4096 Sep 18
|
239
|
-
drwxrwxrwx 11 1000 1000 4096 Sep 18
|
240
|
-
-rw-r--r-- 1 root root
|
241
|
-
-rw-r--r-- 1 root root 167 Sep 18
|
242
|
-
-rwxr-xr-x 1 root root 23520 Sep 18
|
243
|
-
-rw-r--r-- 1 root root
|
244
|
-
-rw-r--r-- 1 root root 302 Sep 18
|
245
|
-
-rwxr-xr-x 1 root root 40216 Sep 18
|
246
|
-
-rw-r--r-- 1 root root
|
247
|
-
-rw-r--r-- 1 root root 106 Sep 18
|
248
|
-
-rwxr-xr-x 1 root root 15616 Sep 18
|
249
|
-
-rw-r--r-- 1 root root
|
250
|
-
-rw-r--r-- 1 root root 164 Sep 18
|
251
|
-
-rwxr-xr-x 1 root root 15656 Sep 18
|
238
|
+
drwxr-xr-x 2 root root 4096 Sep 18 02:00 .
|
239
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 18 02:00 ..
|
240
|
+
-rw-r--r-- 1 root root 1779 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.cpp
|
241
|
+
-rw-r--r-- 1 root root 167 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.h
|
242
|
+
-rwxr-xr-x 1 root root 23520 Sep 18 02:00 jit_all_ops_@7801528c3d61baf7.so
|
243
|
+
-rw-r--r-- 1 root root 1499 Sep 18 02:00 test_add_@469de6acaaabc570.cpp
|
244
|
+
-rw-r--r-- 1 root root 302 Sep 18 02:00 test_add_@469de6acaaabc570.h
|
245
|
+
-rwxr-xr-x 1 root root 40216 Sep 18 02:00 test_add_@469de6acaaabc570.so
|
246
|
+
-rw-r--r-- 1 root root 123 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.cpp
|
247
|
+
-rw-r--r-- 1 root root 106 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.h
|
248
|
+
-rwxr-xr-x 1 root root 15616 Sep 18 02:00 test_other_fn_@75fdd928ab58a8e3.so
|
249
|
+
-rw-r--r-- 1 root root 187 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.cpp
|
250
|
+
-rw-r--r-- 1 root root 164 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.h
|
251
|
+
-rwxr-xr-x 1 root root 15656 Sep 18 02:00 test编译的函数_@3bf4501e0408a243.so
|
252
252
|
|
253
253
|
```
|
254
|
-
## 5. jit_all_ops_@
|
254
|
+
## 5. jit_all_ops_@7801528c3d61baf7.cpp
|
255
255
|
```c++
|
256
|
-
#include "jit_all_ops_@
|
256
|
+
#include "jit_all_ops_@7801528c3d61baf7.h"
|
257
257
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
258
258
|
{
|
259
259
|
auto x = 42;
|
260
|
-
auto y = ((int64_t)(a + b));
|
260
|
+
auto y = ((int64_t)((a + b)));
|
261
261
|
auto z = 3.14;
|
262
262
|
auto flag = true;
|
263
263
|
int64_t nums[] = {1,2,3};
|
264
264
|
int64_t tup[] = {4,5};
|
265
265
|
std::unordered_map<int64_t, int64_t> mp = {{ 1, 10 },{ 2, 20 }};
|
266
|
-
auto pos = +a;
|
267
|
-
auto neg = -b;
|
268
|
-
auto inv = ~a;
|
269
|
-
auto not_flag = !flag;
|
270
|
-
auto add = a + b;
|
271
|
-
auto sub = a - b;
|
272
|
-
auto mul = a * b;
|
273
|
-
auto div = a / ((b != 0) ? (b) : (1));
|
274
|
-
auto mod = a % ((b != 0) ? (b) : (1));
|
275
|
-
auto band = a & b;
|
276
|
-
auto bor = a | b;
|
277
|
-
auto bxor = a ^ b;
|
278
|
-
auto lshift = a << 1;
|
279
|
-
auto rshift = a >> 1;
|
266
|
+
auto pos = (+(a + 1));
|
267
|
+
auto neg = (-b);
|
268
|
+
auto inv = (~a);
|
269
|
+
auto not_flag = (!flag);
|
270
|
+
auto add = (a + b);
|
271
|
+
auto sub = (a - b);
|
272
|
+
auto mul = (a * b);
|
273
|
+
auto div = (a / (((b != 0)) ? (b) : (1)));
|
274
|
+
auto mod = (a % (((b != 0)) ? (b) : (1)));
|
275
|
+
auto band = (a & b);
|
276
|
+
auto bor = (a | b);
|
277
|
+
auto bxor = (a ^ b);
|
278
|
+
auto lshift = (a << 1);
|
279
|
+
auto rshift = (a >> 1);
|
280
280
|
auto cmp1 = (a == b);
|
281
281
|
auto cmp2 = (a != b);
|
282
282
|
auto cmp3 = (a < b);
|
283
283
|
auto cmp4 = (a <= b);
|
284
284
|
auto cmp5 = (a > b);
|
285
285
|
auto cmp6 = (a >= b);
|
286
|
-
auto logic_and = cmp1&&cmp2;
|
287
|
-
auto logic_or = cmp3||cmp4;
|
288
|
-
auto ternary = ((a > b) ? (a) : (b));
|
286
|
+
auto logic_and = (cmp1)&&(cmp2);
|
287
|
+
auto logic_or = (cmp3)||(cmp4);
|
288
|
+
auto ternary = (((a > b)) ? (a) : (b));
|
289
289
|
if ((a > b))
|
290
290
|
{
|
291
|
-
y = y + 1;
|
291
|
+
y = (y + 1);
|
292
292
|
}
|
293
293
|
|
294
294
|
else
|
295
295
|
{
|
296
|
-
y = y - 1;
|
296
|
+
y = (y - 1);
|
297
297
|
}
|
298
298
|
|
299
299
|
for (int64_t i = 0; i < 3; ++i)
|
300
300
|
{
|
301
|
-
y = y + i;
|
301
|
+
y = (y + i);
|
302
302
|
}
|
303
303
|
|
304
304
|
for (auto v : nums)
|
305
305
|
{
|
306
|
-
y = y + v;
|
306
|
+
y = (y + v);
|
307
307
|
if ((v == 2))
|
308
308
|
{
|
309
309
|
continue;
|
@@ -319,23 +319,23 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
319
319
|
auto count = 0;
|
320
320
|
while ((count < 2))
|
321
321
|
{
|
322
|
-
y = y + count;
|
323
|
-
count = count + 1;
|
322
|
+
y = (y + count);
|
323
|
+
count = (count + 1);
|
324
324
|
}
|
325
325
|
|
326
|
-
y = y + 5;
|
327
|
-
y = y - 1;
|
328
|
-
y = y * 2;
|
329
|
-
y = y / 2;
|
330
|
-
y = y % 10;
|
331
|
-
y = y & 7;
|
332
|
-
y = y | 3;
|
333
|
-
y = y ^ 1;
|
334
|
-
y = y << 1;
|
335
|
-
y = y >> 1;
|
326
|
+
y = (y + 5);
|
327
|
+
y = (y - 1);
|
328
|
+
y = (y * 2);
|
329
|
+
y = (y / 2);
|
330
|
+
y = (y % 10);
|
331
|
+
y = (y & 7);
|
332
|
+
y = (y | 3);
|
333
|
+
y = (y ^ 1);
|
334
|
+
y = (y << 1);
|
335
|
+
y = (y >> 1);
|
336
336
|
auto first_num = nums[0];
|
337
337
|
auto mp_val = mp[1];
|
338
|
-
y = y + first_num + mp_val;
|
338
|
+
y = (y + (first_num + mp_val));
|
339
339
|
auto vector = std::vector<int>();
|
340
340
|
vector.push_back(count);
|
341
341
|
vector.push_back(y);
|
@@ -348,7 +348,7 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
348
348
|
}
|
349
349
|
|
350
350
|
```
|
351
|
-
## 6. jit_all_ops_@
|
351
|
+
## 6. jit_all_ops_@7801528c3d61baf7.h
|
352
352
|
```c++
|
353
353
|
#pragma once
|
354
354
|
#include <cstdint>
|
@@ -358,24 +358,24 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
358
358
|
#include <vector>
|
359
359
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b);
|
360
360
|
```
|
361
|
-
## 7. test_add_@
|
361
|
+
## 7. test_add_@469de6acaaabc570.cpp
|
362
362
|
```c++
|
363
|
-
#include "test_add_@
|
363
|
+
#include "test_add_@469de6acaaabc570.h"
|
364
364
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
365
365
|
{
|
366
366
|
if ((a > 1))
|
367
367
|
{
|
368
|
-
return a + b;
|
368
|
+
return ((a + b) * 123123);
|
369
369
|
}
|
370
370
|
|
371
371
|
for (int64_t i = 1; i < 10; i += 2)
|
372
372
|
{
|
373
|
-
a = a + i;
|
373
|
+
a = (a + i);
|
374
374
|
}
|
375
375
|
|
376
376
|
for (auto i : {1,2,3})
|
377
377
|
{
|
378
|
-
a = a + i;
|
378
|
+
a = (a + i);
|
379
379
|
}
|
380
380
|
|
381
381
|
a = std::ceil(12.5);;
|
@@ -401,7 +401,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
401
401
|
std::cout<< u8"测试所有操作:" << " "<< std::endl;;
|
402
402
|
jit_all_ops(a,b);
|
403
403
|
auto v = 0;
|
404
|
-
auto vv = true&&false||1;
|
404
|
+
auto vv = (true)&&((false)||(1));
|
405
405
|
std::cout<< u8"vv:" << " "<< vv << " "<< std::endl;;
|
406
406
|
std::cout<< u8"测试while:" << " "<< std::endl;;
|
407
407
|
while (vv)
|
@@ -419,14 +419,14 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
419
419
|
|
420
420
|
}
|
421
421
|
|
422
|
-
return a + b + 1 + 123 + v;
|
422
|
+
return ((((a + b) + 1) + 123) + v);
|
423
423
|
}
|
424
424
|
|
425
425
|
```
|
426
|
-
## 8. test_add_@
|
426
|
+
## 8. test_add_@469de6acaaabc570.h
|
427
427
|
```c++
|
428
428
|
#pragma once
|
429
|
-
#include "jit_all_ops_@
|
429
|
+
#include "jit_all_ops_@7801528c3d61baf7.h"
|
430
430
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
431
431
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
432
432
|
#include <cmath>
|
@@ -441,7 +441,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b);
|
|
441
441
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
442
442
|
extern "C" int64_t test_other_fn (int64_t a, int64_t b)
|
443
443
|
{
|
444
|
-
return a - b;
|
444
|
+
return (a - b);
|
445
445
|
}
|
446
446
|
|
447
447
|
```
|
@@ -457,7 +457,7 @@ extern "C" int64_t test_other_fn (int64_t a, int64_t b);
|
|
457
457
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
458
458
|
extern "C" int64_t /*test编译的函数*/ function_74657374e7bc96e8af91e79a84e587bde695b0 (int64_t a, int64_t b)
|
459
459
|
{
|
460
|
-
return a * b;
|
460
|
+
return (a * b);
|
461
461
|
}
|
462
462
|
|
463
463
|
```
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|