authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-12-14 19:05:57+01:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-12-14 20:06:46+01:00
log9e5869262a5f07300b7f4ff65dfe60810f22afee
tree14006ca3335e85402b9492a32e3f9d5247978337
parent44556bfebe8d06133c4dfc3cc2685ecb9d3babcd

std: Bool has no definite representation too

The padding bits are undefined.

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

lib/std/meta/trait.zig+2-1
...@@ -476,7 +476,6 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {...@@ -476,7 +476,6 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
476 else => return false, // TODO can we know if it's true for some of these types ?476 else => return false, // TODO can we know if it's true for some of these types ?
477477
478 .AnyFrame,478 .AnyFrame,
479 .Bool,
480 .BoundFn,479 .BoundFn,
481 .Enum,480 .Enum,
482 .ErrorSet,481 .ErrorSet,
...@@ -484,6 +483,8 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {...@@ -484,6 +483,8 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
484 .Pointer,483 .Pointer,
485 => return true,484 => return true,
486485
486 .Bool => return false,
487
487 // The padding bits are undefined.488 // The padding bits are undefined.
488 .Int => |info| return (info.bits % 8) == 0 and489 .Int => |info| return (info.bits % 8) == 0 and
489 (info.bits == 0 or std.math.isPowerOfTwo(info.bits)),490 (info.bits == 0 or std.math.isPowerOfTwo(info.bits)),