Skip to content

Commit 0a86578

Browse files
committed
zig fmt: apply new cast builtin order
1 parent 63d9c5d commit 0a86578

25 files changed

+40
-40
lines changed

lib/compiler_rt/memcpy.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ inline fn copyForwards(
110110
const d = dest + alignment_offset;
111111
const s = src + alignment_offset;
112112

113-
copyBlocksAlignedSource(@ptrCast(d), @alignCast(@ptrCast(s)), n);
113+
copyBlocksAlignedSource(@ptrCast(d), @ptrCast(@alignCast(s)), n);
114114

115115
// copy last `@sizeOf(Element)` bytes unconditionally, since block copy
116116
// methods only copy a multiple of `@sizeOf(Element)` bytes.

lib/compiler_rt/memmove.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ inline fn copyForwards(
157157
const d = dest + alignment_offset;
158158
const s = src + alignment_offset;
159159

160-
copyBlocksAlignedSource(@ptrCast(d), @alignCast(@ptrCast(s)), n);
160+
copyBlocksAlignedSource(@ptrCast(d), @ptrCast(@alignCast(s)), n);
161161

162162
// copy last `copy_size` bytes unconditionally, since block copy
163163
// methods only copy a multiple of `copy_size` bytes.

lib/fuzzer/web/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export fn coveredSourceLocations() usize {
127127
}
128128

129129
fn getCoverageUpdateHeader() *abi.CoverageUpdateHeader {
130-
return @alignCast(@ptrCast(recent_coverage_update.items[0..@sizeOf(abi.CoverageUpdateHeader)]));
130+
return @ptrCast(@alignCast(recent_coverage_update.items[0..@sizeOf(abi.CoverageUpdateHeader)]));
131131
}
132132

133133
export fn totalRuns() u64 {

lib/std/array_hash_map.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,7 @@ const IndexHeader = struct {
20862086
/// Returns the attached array of indexes. I must match the type
20872087
/// returned by capacityIndexType.
20882088
fn indexes(header: *IndexHeader, comptime I: type) []Index(I) {
2089-
const start_ptr: [*]Index(I) = @alignCast(@ptrCast(@as([*]u8, @ptrCast(header)) + @sizeOf(IndexHeader)));
2089+
const start_ptr: [*]Index(I) = @ptrCast(@alignCast(@as([*]u8, @ptrCast(header)) + @sizeOf(IndexHeader)));
20902090
return start_ptr[0..header.length()];
20912091
}
20922092

@@ -2122,7 +2122,7 @@ const IndexHeader = struct {
21222122
const nbytes = @sizeOf(IndexHeader) + index_size * len;
21232123
const bytes = try gpa.alignedAlloc(u8, .of(IndexHeader), nbytes);
21242124
@memset(bytes[@sizeOf(IndexHeader)..], 0xff);
2125-
const result: *IndexHeader = @alignCast(@ptrCast(bytes.ptr));
2125+
const result: *IndexHeader = @ptrCast(@alignCast(bytes.ptr));
21262126
result.* = .{
21272127
.bit_index = new_bit_index,
21282128
};

lib/std/crypto/codecs/asn1/der/Encoder.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn anyTag(self: *Encoder, tag_: Tag, val: anytype) !void {
3737
// > The encoding of a set value or sequence value shall not include an encoding for any
3838
// > component value which is equal to its default value.
3939
const is_default = if (f.is_comptime) false else if (f.default_value_ptr) |v| brk: {
40-
const default_val: *const f.type = @alignCast(@ptrCast(v));
40+
const default_val: *const f.type = @ptrCast(@alignCast(v));
4141
break :brk std.mem.eql(u8, std.mem.asBytes(default_val), std.mem.asBytes(&field_val));
4242
} else false;
4343

lib/std/crypto/timing_safe.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn markSecret(ptr: anytype, comptime action: enum { classify, declassify }) void
147147
@compileError("A pointer value is always assumed leak information via side channels");
148148
},
149149
else => {
150-
const mem8: *const [@sizeOf(@TypeOf(ptr.*))]u8 = @constCast(@ptrCast(ptr));
150+
const mem8: *const [@sizeOf(@TypeOf(ptr.*))]u8 = @ptrCast(@constCast(ptr));
151151
if (action == .classify) {
152152
std.valgrind.memcheck.makeMemUndefined(mem8);
153153
} else {

lib/std/debug/SelfInfo.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ pub const WindowsModule = struct {
836836

837837
pub fn deinit(self: @This()) void {
838838
const process_handle = windows.GetCurrentProcess();
839-
assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @constCast(@ptrCast(self.section_view.ptr))) == .SUCCESS);
839+
assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @ptrCast(@constCast(self.section_view.ptr))) == .SUCCESS);
840840
windows.CloseHandle(self.section_handle);
841841
self.file.close();
842842
}

lib/std/hash_map.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ pub fn HashMapUnmanaged(
15111511

15121512
const total_size = std.mem.alignForward(usize, vals_end, max_align);
15131513

1514-
const slice = @as([*]align(max_align) u8, @alignCast(@ptrCast(self.header())))[0..total_size];
1514+
const slice = @as([*]align(max_align) u8, @ptrCast(@alignCast(self.header())))[0..total_size];
15151515
allocator.free(slice);
15161516

15171517
self.metadata = null;

lib/std/heap.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const CAllocator = struct {
151151
};
152152

153153
fn getHeader(ptr: [*]u8) *[*]u8 {
154-
return @alignCast(@ptrCast(ptr - @sizeOf(usize)));
154+
return @ptrCast(@alignCast(ptr - @sizeOf(usize)));
155155
}
156156

157157
fn alignedAlloc(len: usize, alignment: Alignment) ?[*]u8 {

lib/std/heap/SmpAllocator.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn free(context: *anyopaque, memory: []u8, alignment: mem.Alignment, ra: usize)
205205
return PageAllocator.unmap(@alignCast(memory));
206206
}
207207

208-
const node: *usize = @alignCast(@ptrCast(memory.ptr));
208+
const node: *usize = @ptrCast(@alignCast(memory.ptr));
209209

210210
const t = Thread.lock();
211211
defer t.unlock();

0 commit comments

Comments
 (0)