From f1171b78c81782525901d84115f152c8d032fdb6 Mon Sep 17 00:00:00 2001 From: CodeHz Date: Sun, 6 Sep 2020 07:12:55 +0000 Subject: [PATCH] fix for ziglang pull 6246 --- zig-ecs/src/ecs/entity.zig | 6 +++--- zig-ecs/src/ecs/groups.zig | 4 ++-- zig-ecs/src/ecs/handles.zig | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zig-ecs/src/ecs/entity.zig b/zig-ecs/src/ecs/entity.zig index c8f505a..2679232 100644 --- a/zig-ecs/src/ecs/entity.zig +++ b/zig-ecs/src/ecs/entity.zig @@ -14,9 +14,9 @@ pub fn EntityTraitsType(comptime size: EntityTraitsSize) type { } fn EntityTraitsDefinition(comptime EntityType: type, comptime IndexType: type, comptime VersionType: type) type { - std.debug.assert(@typeInfo(EntityType) == .Int and !EntityType.is_signed); - std.debug.assert(@typeInfo(IndexType) == .Int and !IndexType.is_signed); - std.debug.assert(@typeInfo(VersionType) == .Int and !VersionType.is_signed); + std.debug.assert(@typeInfo(EntityType) == .Int and !@typeInfo(EntityType).Int.is_signed); + std.debug.assert(@typeInfo(IndexType) == .Int and !@typeInfo(IndexType).Int.is_signed); + std.debug.assert(@typeInfo(VersionType) == .Int and !@typeInfo(VersionType).Int.is_signed); if (@bitSizeOf(IndexType) + @bitSizeOf(VersionType) != @bitSizeOf(EntityType)) @compileError("IndexType and VersionType must sum to EntityType's bit count"); diff --git a/zig-ecs/src/ecs/groups.zig b/zig-ecs/src/ecs/groups.zig index b5a03b9..683d1f4 100644 --- a/zig-ecs/src/ecs/groups.zig +++ b/zig-ecs/src/ecs/groups.zig @@ -85,7 +85,7 @@ pub const OwningGroup = struct { var component_ptrs: [component_info.fields.len][*]u8 = undefined; inline for (component_info.fields) |field, i| { - const storage = group.registry.assure(field.field_type.Child); + const storage = group.registry.assure(@typeInfo(field.field_type).Pointer.child); component_ptrs[i] = @ptrCast([*]u8, storage.instances.items.ptr); } @@ -104,7 +104,7 @@ pub const OwningGroup = struct { // fill and return the struct var comps: Components = undefined; inline for (@typeInfo(Components).Struct.fields) |field, i| { - const typed_ptr = @ptrCast([*]field.field_type.Child, @alignCast(@alignOf(field.field_type.Child), it.component_ptrs[i])); + const typed_ptr = @ptrCast([*]@typeInfo(field.field_type).Pointer.child, @alignCast(@alignOf(@typeInfo(field.field_type).Pointer.child), it.component_ptrs[i])); @field(comps, field.name) = &typed_ptr[it.index]; } return comps; diff --git a/zig-ecs/src/ecs/handles.zig b/zig-ecs/src/ecs/handles.zig index 567aeb9..d769087 100644 --- a/zig-ecs/src/ecs/handles.zig +++ b/zig-ecs/src/ecs/handles.zig @@ -4,9 +4,9 @@ const std = @import("std"); /// you choose the type of the handle (aka its size) and how much of that goes to the index and the version. /// the bitsize of version + id must equal the handle size. pub fn Handles(comptime HandleType: type, comptime IndexType: type, comptime VersionType: type) type { - std.debug.assert(@typeInfo(HandleType) == .Int and !HandleType.is_signed); - std.debug.assert(@typeInfo(IndexType) == .Int and !IndexType.is_signed); - std.debug.assert(@typeInfo(VersionType) == .Int and !VersionType.is_signed); + std.debug.assert(@typeInfo(HandleType) == .Int and !@typeInfo(HandleType).Int.is_signed); + std.debug.assert(@typeInfo(IndexType) == .Int and !@typeInfo(IndexType).Int.is_signed); + std.debug.assert(@typeInfo(VersionType) == .Int and !@typeInfo(VersionType).Int.is_signed); if (@bitSizeOf(IndexType) + @bitSizeOf(VersionType) != @bitSizeOf(HandleType)) @compileError("IndexType and VersionType must sum to HandleType's bit count");