ecs: Capacity calculation can overflow resulting in an infinite loop at runtime or a panic in debug/safe
see https://github.com/ziglang/zig/issues/12099
try storage.ensureTotalCapacity(gpa, math.maxInt(usize));
@addWithOverflow would solve this case.
https://github.com/hexops/mach/blob/f8f4dcf55fc0b7365abfa66304e1f781b5f4eb42/ecs/src/entities.zig#L130-L133
lol i was already working on this
new issue https://github.com/ziglang/zig/issues/12118
@addWithOverflowwould solve this case.
+| (saturated add) would probably be better
Fixed!
@alichraghi it looks like the code is still the same to me; we should update it to use a saturated add.
https://github.com/hexops/mach/blob/main/libs/ecs/src/entities.zig#L131-L132
Unless I'm missing something?
sorry i thought this is an upstream issue (https://github.com/ziglang/zig/issues/12099)