mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
terminal: RefCountedSize should use usize for byte math
Related to #1873
This commit is contained in:
@ -141,10 +141,12 @@ pub fn RefCountedSet(
|
|||||||
const items_cap: Id = @intFromFloat(load_factor * @as(f64, @floatFromInt(table_cap)));
|
const items_cap: Id = @intFromFloat(load_factor * @as(f64, @floatFromInt(table_cap)));
|
||||||
|
|
||||||
const table_start = 0;
|
const table_start = 0;
|
||||||
const table_end = table_start + table_cap * @sizeOf(Id);
|
const table_cap_usize: usize = @intCast(table_cap);
|
||||||
|
const table_end = table_start + table_cap_usize * @sizeOf(Id);
|
||||||
|
|
||||||
const items_start = std.mem.alignForward(usize, table_end, @alignOf(Item));
|
const items_start = std.mem.alignForward(usize, table_end, @alignOf(Item));
|
||||||
const items_end = items_start + items_cap * @sizeOf(Item);
|
const items_cap_usize: usize = @intCast(items_cap);
|
||||||
|
const items_end = items_start + items_cap_usize * @sizeOf(Item);
|
||||||
|
|
||||||
const total_size = items_end;
|
const total_size = items_end;
|
||||||
|
|
||||||
|
@ -314,3 +314,8 @@ test "Set basic usage" {
|
|||||||
set.release(buf, id);
|
set.release(buf, id);
|
||||||
try testing.expect(set.refCount(buf, id) == 0);
|
try testing.expect(set.refCount(buf, id) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Set capacities" {
|
||||||
|
// We want to support at least this many styles without overflowing.
|
||||||
|
_ = Set.layout(16384);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user