File tree Expand file tree Collapse file tree 2 files changed +22
-17
lines changed
Expand file tree Collapse file tree 2 files changed +22
-17
lines changed Original file line number Diff line number Diff line change 11const std = @import ("std" );
22
33pub fn build (b : * std.Build ) void {
4+ const optimize = b .standardOptimizeOption (.{});
5+
6+ const target_query = std.Target.Query {
7+ .cpu_arch = .wasm32 ,
8+ .os_tag = .freestanding ,
9+ .cpu_features_add = std .Target .wasm .featureSet (&.{
10+ .simd128 ,
11+ .relaxed_simd ,
12+ .tail_call ,
13+ }),
14+ };
15+ const target = b .resolveTargetQuery (target_query );
16+
417 const lib = b .addExecutable (.{
518 .name = "zig" ,
6- .root_source_file = b .path ("main.zig" ),
7- .target = b .resolveTargetQuery (.{
8- .cpu_arch = .wasm32 ,
9- .os_tag = .freestanding ,
10- .cpu_features_add = std .Target .wasm .featureSet (&.{
11- .simd128 ,
12- .relaxed_simd ,
13- .tail_call ,
14- }),
19+ .root_module = b .createModule (.{
20+ .root_source_file = b .path ("main.zig" ),
21+ .target = target ,
22+ .optimize = optimize ,
1523 }),
1624 .use_llvm = true ,
1725 .use_lld = true ,
18- .optimize = b .standardOptimizeOption (.{}),
1926 });
27+
2028 lib .entry = .disabled ;
2129 lib .rdynamic = true ;
2230 lib .want_lto = true ;
31+
2332 b .installArtifact (lib );
2433}
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ const opt = .{
77 .parse = std.json.ParseOptions {
88 .ignore_unknown_fields = true ,
99 },
10- .stringify = std.json.StringifyOptions {
11- .whitespace = .minified ,
12- },
1310};
1411
1512pub const Data = struct {
@@ -27,12 +24,11 @@ export fn echoNumber() i32 {
2724}
2825
2926export fn echoStruct () u64 {
30- _ = arena .reset (.retain_capacity );
27+ _ = arena .reset (.{ . retain_with_limit = std . math . maxInt ( usize ) } );
3128 const input = decodeString (getStruct ());
3229 const json = std .json .parseFromSlice (Data , ally , input , opt .parse ) catch unreachable ;
33- var output = std .ArrayList (u8 ).init (ally );
34- std .json .stringify (json .value , opt .stringify , output .writer ()) catch unreachable ;
35- return encodeString (output .items );
30+ const output = std .json .Stringify .valueAlloc (ally , json .value , .{}) catch unreachable ;
31+ return encodeString (output );
3632}
3733
3834export fn fi (n : i32 ) i32 {
You can’t perform that action at this time.
0 commit comments