Skip to content

Commit

Permalink
zig fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Apr 25, 2023
1 parent c336d7f commit 1d7592c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/std/hash/murmur.zig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub const Murmur2_64 = struct {
pub fn hashWithSeed(str: []const u8, seed: u64) u64 {
const m: u64 = 0xc6a4a7935bd1e995;
var h1: u64 = seed ^ (@as(u64, str.len) *% m);
for (@ptrCast([*]align(1) const u64, str.ptr)[0..str.len / 8]) |v| {
for (@ptrCast([*]align(1) const u64, str.ptr)[0 .. str.len / 8]) |v| {
var k1: u64 = v;
if (native_endian == .Big)
k1 = @byteSwap(k1);
Expand Down Expand Up @@ -291,7 +291,7 @@ fn SMHasherTest(comptime hash_fn: anytype, comptime hashbits: u32) u32 {
var h = hash_fn(key[0..i], 256 - i);
if (native_endian == .Big)
h = @byteSwap(h);
@memcpy(hashes[i * hashbytes..][0..hashbytes], @ptrCast([*]u8, &h));
@memcpy(hashes[i * hashbytes ..][0..hashbytes], @ptrCast([*]u8, &h));
}

return @truncate(u32, hash_fn(&hashes, 0));
Expand Down
2 changes: 1 addition & 1 deletion lib/std/hash_map.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ pub fn HashMapUnmanaged(
}

fn initMetadatas(self: *Self) void {
@memset(@ptrCast([*]u8, self.metadata.?)[0..@sizeOf(Metadata) * self.capacity()], 0);
@memset(@ptrCast([*]u8, self.metadata.?)[0 .. @sizeOf(Metadata) * self.capacity()], 0);
}

// This counts the number of occupied slots (not counting tombstones), which is
Expand Down
1 change: 0 additions & 1 deletion lib/std/heap/general_purpose_allocator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1412,4 +1412,3 @@ test "bug 9995 fix, large allocs count requested size not backing size" {
buf = try allocator.realloc(buf, 2);
try std.testing.expect(gpa.total_requested_bytes == 2);
}

6 changes: 3 additions & 3 deletions lib/std/os/windows.zig
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,9 @@ pub fn CreateSymbolicLink(
};

std.mem.copy(u8, buffer[0..], std.mem.asBytes(&symlink_data));
@memcpy(buffer[@sizeOf(SYMLINK_DATA)..][0..target_path.len * 2], @ptrCast([*]const u8, target_path));
@memcpy(buffer[@sizeOf(SYMLINK_DATA)..][0 .. target_path.len * 2], @ptrCast([*]const u8, target_path));
const paths_start = @sizeOf(SYMLINK_DATA) + target_path.len * 2;
@memcpy(buffer[paths_start..][0..target_path.len * 2], @ptrCast([*]const u8, target_path));
@memcpy(buffer[paths_start..][0 .. target_path.len * 2], @ptrCast([*]const u8, target_path));
_ = try DeviceIoControl(symlink_handle, FSCTL_SET_REPARSE_POINT, buffer[0..buf_len], null);
}

Expand Down Expand Up @@ -1179,7 +1179,7 @@ pub fn GetFinalPathNameByHandle(
var input_struct = @ptrCast(*MOUNTMGR_MOUNT_POINT, &input_buf[0]);
input_struct.DeviceNameOffset = @sizeOf(MOUNTMGR_MOUNT_POINT);
input_struct.DeviceNameLength = @intCast(USHORT, volume_name_u16.len * 2);
@memcpy(input_buf[@sizeOf(MOUNTMGR_MOUNT_POINT)..][0..volume_name_u16.len * 2], @ptrCast([*]const u8, volume_name_u16.ptr));
@memcpy(input_buf[@sizeOf(MOUNTMGR_MOUNT_POINT)..][0 .. volume_name_u16.len * 2], @ptrCast([*]const u8, volume_name_u16.ptr));

DeviceIoControl(mgmt_handle, IOCTL_MOUNTMGR_QUERY_POINTS, &input_buf, &output_buf) catch |err| switch (err) {
error.AccessDenied => unreachable,
Expand Down

0 comments on commit 1d7592c

Please sign in to comment.