mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
zig fmt
This commit is contained in:
parent
792bbfa301
commit
401b7f6f53
@ -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);
|
||||
@ -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));
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user