Remove unneeded casts.

master
Euan Torano 2019-08-07 22:19:25 +01:00
parent 2d25348f63
commit f2bef0447a
No known key found for this signature in database
GPG Key ID: 8DCD87C3275A7B24
1 changed files with 3 additions and 3 deletions

View File

@ -140,16 +140,16 @@ pub const RtlGenRandomError = error{Unexpected};
pub fn RtlGenRandom(output: []u8) RtlGenRandomError!void {
var total_read: usize = 0;
var buff: []u8 = output[0..];
const max_read_size: ULONG = ULONG(maxInt(ULONG));
const max_read_size: ULONG = maxInt(ULONG);
while (total_read < output.len) {
const to_read: ULONG = @intCast(ULONG, math.min(buff.len, max_read_size));
const to_read: ULONG = math.min(buff.len, max_read_size);
if (advapi32.RtlGenRandom(buff.ptr, to_read) == 0) {
return unexpectedError(kernel32.GetLastError());
}
total_read += @intCast(usize, to_read);
total_read += to_read;
buff = buff[to_read..];
}
}