authorgravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2020-11-16 12:50:05+01:00
committergravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2020-11-16 12:50:05+01:00
log109a3ebcca2928b1d5f40accab9a8b6a03ea750b
tree656c54beaeeea6d41f5bdeb6eb79f3b09ac47278
parent92e45ee3a18cd88e90aedef467a2d203d9b330c2

std.mem: make args comptime, fix test names


1 files changed, 5 insertions(+), 5 deletions(-)

lib/std/mem.zig+5-5
...@@ -1937,7 +1937,7 @@ pub fn nativeToBig(comptime T: type, x: T) T {...@@ -1937,7 +1937,7 @@ pub fn nativeToBig(comptime T: type, x: T) T {
1937 };1937 };
1938}1938}
19391939
1940fn CopyPtrAttrs(comptime source: type, size: builtin.TypeInfo.Pointer.Size, child: type) type {1940fn CopyPtrAttrs(comptime source: type, comptime size: builtin.TypeInfo.Pointer.Size, comptime child: type) type {
1941 const info = @typeInfo(source).Pointer;1941 const info = @typeInfo(source).Pointer;
1942 return @Type(.{1942 return @Type(.{
1943 .Pointer = .{1943 .Pointer = .{
...@@ -2001,7 +2001,7 @@ test "asBytes" {...@@ -2001,7 +2001,7 @@ test "asBytes" {
2001 testing.expect(eql(u8, asBytes(&zero), ""));2001 testing.expect(eql(u8, asBytes(&zero), ""));
2002}2002}
20032003
2004test "asBytes preserves qualifiers" {2004test "asBytes preserves pointer attributes" {
2005 const inArr: u32 align(16) = 0xDEADBEEF;2005 const inArr: u32 align(16) = 0xDEADBEEF;
2006 const inPtr = @ptrCast(*align(16) const volatile u32, &inArr);2006 const inPtr = @ptrCast(*align(16) const volatile u32, &inArr);
2007 const outSlice = asBytes(inPtr);2007 const outSlice = asBytes(inPtr);
...@@ -2090,7 +2090,7 @@ test "bytesAsValue" {...@@ -2090,7 +2090,7 @@ test "bytesAsValue" {
2090 testing.expect(meta.eql(inst, inst2.*));2090 testing.expect(meta.eql(inst, inst2.*));
2091}2091}
20922092
2093test "bytesAsValue preserves qualifiers" {2093test "bytesAsValue preserves pointer attributes" {
2094 const inArr align(16) = [4]u8{ 0xDE, 0xAD, 0xBE, 0xEF };2094 const inArr align(16) = [4]u8{ 0xDE, 0xAD, 0xBE, 0xEF };
2095 const inSlice = @ptrCast(*align(16) const volatile [4]u8, &inArr)[0..];2095 const inSlice = @ptrCast(*align(16) const volatile [4]u8, &inArr)[0..];
2096 const outPtr = bytesAsValue(u32, inSlice);2096 const outPtr = bytesAsValue(u32, inSlice);
...@@ -2198,7 +2198,7 @@ test "bytesAsSlice with specified alignment" {...@@ -2198,7 +2198,7 @@ test "bytesAsSlice with specified alignment" {
2198 testing.expect(slice[0] == 0x33333333);2198 testing.expect(slice[0] == 0x33333333);
2199}2199}
22002200
2201test "bytesAsSlice preserves qualifiers" {2201test "bytesAsSlice preserves pointer attributes" {
2202 const inArr align(16) = [4]u8{ 0xDE, 0xAD, 0xBE, 0xEF };2202 const inArr align(16) = [4]u8{ 0xDE, 0xAD, 0xBE, 0xEF };
2203 const inSlice = @ptrCast(*align(16) const volatile [4]u8, &inArr)[0..];2203 const inSlice = @ptrCast(*align(16) const volatile [4]u8, &inArr)[0..];
2204 const outSlice = bytesAsSlice(u16, inSlice);2204 const outSlice = bytesAsSlice(u16, inSlice);
...@@ -2302,7 +2302,7 @@ test "sliceAsBytes and bytesAsSlice back" {...@@ -2302,7 +2302,7 @@ test "sliceAsBytes and bytesAsSlice back" {
2302 testing.expect(bytes[11] == math.maxInt(u8));2302 testing.expect(bytes[11] == math.maxInt(u8));
2303}2303}
23042304
2305test "sliceAsBytes preserves qualifiers" {2305test "sliceAsBytes preserves pointer attributes" {
2306 const inArr align(16) = [2]u16{ 0xDEAD, 0xBEEF };2306 const inArr align(16) = [2]u16{ 0xDEAD, 0xBEEF };
2307 const inSlice = @ptrCast(*align(16) const volatile [2]u16, &inArr)[0..];2307 const inSlice = @ptrCast(*align(16) const volatile [2]u16, &inArr)[0..];
2308 const outSlice = sliceAsBytes(inSlice);2308 const outSlice = sliceAsBytes(inSlice);