authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-05-28 15:31:48-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-01 16:35:29-07:00
log3ef75356f6f5f1be170006c122c16df56961cf15
tree42266eb5e1402835d0ec80582857c913b79d89e7
parent38a86bd7019262bbcc654bf5bcc5e253f18d9d38

delete more dead code


1 files changed, 10 insertions(+), 31 deletions(-)

src/deprecated.zig+10-31
......@@ -65,7 +65,7 @@ pub fn LinearFifo(comptime T: type) type {
6565 pub fn ensureTotalCapacity(self: *Self, size: usize) !void {
6666 if (self.buf.len >= size) return;
6767 self.realign();
68 const new_size = if (true) math.ceilPowerOfTwo(usize, size) catch return error.OutOfMemory else size;
68 const new_size = math.ceilPowerOfTwo(usize, size) catch return error.OutOfMemory;
6969 self.buf = try self.allocator.realloc(self.buf, new_size);
7070 }
7171
......@@ -126,21 +126,12 @@ pub fn LinearFifo(comptime T: type) type {
126126 @memset(unused2, undefined);
127127 }
128128 }
129 if (false and self.count == count) {
130 self.head = 0;
131 self.count = 0;
132 } else {
133 var head = self.head + count;
134 if (true) {
135 // Note it is safe to do a wrapping subtract as
136 // bitwise & with all 1s is a noop
137 head &= self.buf.len -% 1;
138 } else {
139 head %= self.buf.len;
140 }
141 self.head = head;
142 self.count -= count;
143 }
129 var head = self.head + count;
130 // Note it is safe to do a wrapping subtract as
131 // bitwise & with all 1s is a noop
132 head &= self.buf.len -% 1;
133 self.head = head;
134 self.count -= count;
144135 }
145136
146137 /// Read the next item from the fifo
......@@ -270,11 +261,7 @@ pub fn LinearFifo(comptime T: type) type {
270261
271262 pub fn writeItemAssumeCapacity(self: *Self, item: T) void {
272263 var tail = self.head + self.count;
273 if (true) {
274 tail &= self.buf.len - 1;
275 } else {
276 tail %= self.buf.len;
277 }
264 tail &= self.buf.len - 1;
278265 self.buf[tail] = item;
279266 self.update(1);
280267 }
......@@ -333,11 +320,7 @@ pub fn LinearFifo(comptime T: type) type {
333320 assert(self.writableLength() >= count);
334321
335322 var head = self.head + (self.buf.len - count);
336 if (true) {
337 head &= self.buf.len - 1;
338 } else {
339 head %= self.buf.len;
340 }
323 head &= self.buf.len - 1;
341324 self.head = head;
342325 self.count += count;
343326 }
......@@ -364,11 +347,7 @@ pub fn LinearFifo(comptime T: type) type {
364347 assert(offset < self.count);
365348
366349 var index = self.head + offset;
367 if (true) {
368 index &= self.buf.len - 1;
369 } else {
370 index %= self.buf.len;
371 }
350 index &= self.buf.len - 1;
372351 return self.buf[index];
373352 }
374353