Function secureZero [src]
Sets a slice to zeroes.
Prevents the store from being optimized out.
Prototype
pub inline fn secureZero(comptime T: type, s: []volatile T) void
Parameters
T: type
s: []volatile T
Example
test secureZero {
var a = [_]u8{0xfe} ** 8;
var b = [_]u8{0xfe} ** 8;
@memset(&a, 0);
secureZero(u8, &b);
try std.testing.expectEqualSlices(u8, &a, &b);
}
Source
pub inline fn secureZero(comptime T: type, s: []volatile T) void {
@memset(s, 0);
}