Skip to content

Commit 1c73c08

Browse files
emekoiandrewrk
authored andcommitted
ran zig fmt on stdlib
1 parent 6672ee9 commit 1c73c08

File tree

8 files changed

+71
-149
lines changed

8 files changed

+71
-149
lines changed

std/debug.zig

+10-8
Original file line numberDiff line numberDiff line change
@@ -1490,14 +1490,16 @@ fn parseFormValueTargetAddrSize(in_stream: var) !u64 {
14901490
}
14911491

14921492
fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, size: i32) !FormValue {
1493-
return FormValue{ .Ref = switch (size) {
1494-
1 => try in_stream.readIntLittle(u8),
1495-
2 => try in_stream.readIntLittle(u16),
1496-
4 => try in_stream.readIntLittle(u32),
1497-
8 => try in_stream.readIntLittle(u64),
1498-
-1 => try leb.readULEB128(u64, in_stream),
1499-
else => unreachable,
1500-
} };
1493+
return FormValue{
1494+
.Ref = switch (size) {
1495+
1 => try in_stream.readIntLittle(u8),
1496+
2 => try in_stream.readIntLittle(u16),
1497+
4 => try in_stream.readIntLittle(u32),
1498+
8 => try in_stream.readIntLittle(u64),
1499+
-1 => try leb.readULEB128(u64, in_stream),
1500+
else => unreachable,
1501+
},
1502+
};
15011503
}
15021504

15031505
fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, is_64: bool) anyerror!FormValue {

std/io.zig

+12-8
Original file line numberDiff line numberDiff line change
@@ -1116,10 +1116,12 @@ pub fn Deserializer(comptime endian: builtin.Endian, comptime packing: Packing,
11161116
pub const Stream = InStream(Error);
11171117

11181118
pub fn init(in_stream: *Stream) Self {
1119-
return Self{ .in_stream = switch (packing) {
1120-
.Bit => BitInStream(endian, Stream.Error).init(in_stream),
1121-
.Byte => in_stream,
1122-
} };
1119+
return Self{
1120+
.in_stream = switch (packing) {
1121+
.Bit => BitInStream(endian, Stream.Error).init(in_stream),
1122+
.Byte => in_stream,
1123+
},
1124+
};
11231125
}
11241126

11251127
pub fn alignToByte(self: *Self) void {
@@ -1325,10 +1327,12 @@ pub fn Serializer(comptime endian: builtin.Endian, comptime packing: Packing, co
13251327
pub const Stream = OutStream(Error);
13261328

13271329
pub fn init(out_stream: *Stream) Self {
1328-
return Self{ .out_stream = switch (packing) {
1329-
.Bit => BitOutStream(endian, Stream.Error).init(out_stream),
1330-
.Byte => out_stream,
1331-
} };
1330+
return Self{
1331+
.out_stream = switch (packing) {
1332+
.Bit => BitOutStream(endian, Stream.Error).init(out_stream),
1333+
.Byte => out_stream,
1334+
},
1335+
};
13321336
}
13331337

13341338
/// Flushes any unwritten bits to the stream

std/os/linux/tls.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub fn setThreadPointer(addr: usize) void {
114114
.aarch64 => {
115115
asm volatile (
116116
\\ msr tpidr_el0, %[addr]
117-
:
117+
:
118118
: [addr] "r" (addr)
119119
);
120120
},

std/special/bootstrap.zig

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ const assert = std.debug.assert;
88

99
var argc_ptr: [*]usize = undefined;
1010

11-
const is_wasm = switch (builtin.arch) { .wasm32, .wasm64 => true, else => false};
11+
const is_wasm = switch (builtin.arch) {
12+
.wasm32, .wasm64 => true,
13+
else => false,
14+
};
1215

1316
comptime {
1417
if (builtin.link_libc) {

std/special/c.zig

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ const std = @import("std");
88
const builtin = @import("builtin");
99
const maxInt = std.math.maxInt;
1010

11-
const is_wasm = switch (builtin.arch) { .wasm32, .wasm64 => true, else => false};
12-
const is_freestanding = switch (builtin.os) { .freestanding => true, else => false };
11+
const is_wasm = switch (builtin.arch) {
12+
.wasm32, .wasm64 => true,
13+
else => false,
14+
};
15+
const is_freestanding = switch (builtin.os) {
16+
.freestanding => true,
17+
else => false,
18+
};
1319
comptime {
1420
if (is_freestanding and is_wasm and builtin.link_libc) {
1521
@export("_start", wasm_start, .Strong);

std/special/compiler_rt/extendXfYf2.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: @IntType(false, @t
7676
// renormalize the significand and clear the leading bit, then insert
7777
// the correct adjusted exponent in the destination type.
7878
const scale: u32 = @clz(src_rep_t, aAbs) -
79-
@clz(src_rep_t, src_rep_t(srcMinNormal));
79+
@clz(src_rep_t, src_rep_t(srcMinNormal));
8080
absResult = dst_rep_t(aAbs) << @intCast(DstShift, dstSigBits - srcSigBits + scale);
8181
absResult ^= dstMinNormal;
8282
const resultExponent: u32 = dstExpBias - srcExpBias - scale + 1;

std/valgrind/callgrind.zig

+9-32
Original file line numberDiff line numberDiff line change
@@ -10,70 +10,48 @@ pub const CallgrindClientRequest = extern enum {
1010
StopInstrumentation,
1111
};
1212

13-
fn doCallgrindClientRequestExpr(default: usize, request: CallgrindClientRequest,
14-
a1: usize, a2: usize, a3: usize, a4: usize, a5: usize
15-
) usize
16-
{
17-
return valgrind.doClientRequest(
18-
default,
19-
@intCast(usize, @enumToInt(request)),
20-
a1, a2, a3, a4, a5);
13+
fn doCallgrindClientRequestExpr(default: usize, request: CallgrindClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize {
14+
return valgrind.doClientRequest(default, @intCast(usize, @enumToInt(request)), a1, a2, a3, a4, a5);
2115
}
2216

23-
fn doCallgrindClientRequestStmt(request: CallgrindClientRequest,
24-
a1: usize, a2: usize, a3: usize, a4: usize, a5: usize
25-
) void
26-
{
17+
fn doCallgrindClientRequestStmt(request: CallgrindClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void {
2718
_ = doCallgrindClientRequestExpr(0, request, a1, a2, a3, a4, a5);
2819
}
2920

30-
31-
3221
/// Dump current state of cost centers, and zero them afterwards
3322
pub fn dumpStats() void {
34-
doCallgrindClientRequestStmt(CallgrindClientRequest.DumpStats,
35-
0, 0, 0, 0, 0);
23+
doCallgrindClientRequestStmt(CallgrindClientRequest.DumpStats, 0, 0, 0, 0, 0);
3624
}
3725

38-
3926
/// Dump current state of cost centers, and zero them afterwards.
4027
/// The argument is appended to a string stating the reason which triggered
4128
/// the dump. This string is written as a description field into the
4229
/// profile data dump.
4330
pub fn dumpStatsAt(pos_str: [*]u8) void {
44-
doCallgrindClientRequestStmt(CallgrindClientRequest.DumpStatsAt,
45-
@ptrToInt(pos_str),
46-
0, 0, 0, 0);
31+
doCallgrindClientRequestStmt(CallgrindClientRequest.DumpStatsAt, @ptrToInt(pos_str), 0, 0, 0, 0);
4732
}
4833

49-
5034
/// Zero cost centers
5135
pub fn zeroStats() void {
52-
doCallgrindClientRequestStmt(CallgrindClientRequest.ZeroStats,
53-
0, 0, 0, 0, 0);
36+
doCallgrindClientRequestStmt(CallgrindClientRequest.ZeroStats, 0, 0, 0, 0, 0);
5437
}
5538

56-
5739
/// Toggles collection state.
5840
/// The collection state specifies whether the happening of events
5941
/// should be noted or if they are to be ignored. Events are noted
6042
/// by increment of counters in a cost center
6143
pub fn toggleCollect() void {
62-
doCallgrindClientRequestStmt(CallgrindClientRequest.ToggleCollect,
63-
0, 0, 0, 0, 0);
44+
doCallgrindClientRequestStmt(CallgrindClientRequest.ToggleCollect, 0, 0, 0, 0, 0);
6445
}
6546

66-
6747
/// Start full callgrind instrumentation if not already switched on.
6848
/// When cache simulation is done, it will flush the simulated cache;
6949
/// this will lead to an artificial cache warmup phase afterwards with
7050
/// cache misses which would not have happened in reality.
7151
pub fn startInstrumentation() void {
72-
doCallgrindClientRequestStmt(CallgrindClientRequest.StartInstrumentation,
73-
0, 0, 0, 0, 0);
52+
doCallgrindClientRequestStmt(CallgrindClientRequest.StartInstrumentation, 0, 0, 0, 0, 0);
7453
}
7554

76-
7755
/// Stop full callgrind instrumentation if not already switched off.
7856
/// This flushes Valgrinds translation cache, and does no additional
7957
/// instrumentation afterwards, which effectivly will run at the same
@@ -82,6 +60,5 @@ pub fn startInstrumentation() void {
8260
/// To start Callgrind in this mode to ignore the setup phase, use
8361
/// the option "--instr-atstart=no".
8462
pub fn stopInstrumentation() void {
85-
doCallgrindClientRequestStmt(CallgrindClientRequest.StopInstrumentation,
86-
0, 0, 0, 0, 0);
63+
doCallgrindClientRequestStmt(CallgrindClientRequest.StopInstrumentation, 0, 0, 0, 0, 0);
8764
}

0 commit comments

Comments
 (0)