fix for ziglang pull 6246

master
CodeHz 4 years ago
parent 6b4ed304a6
commit f1171b78c8

@ -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");

@ -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;

@ -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");

Loading…
Cancel
Save