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 {...@@ -65,7 +65,7 @@ pub fn LinearFifo(comptime T: type) type {
65 pub fn ensureTotalCapacity(self: *Self, size: usize) !void {65 pub fn ensureTotalCapacity(self: *Self, size: usize) !void {
66 if (self.buf.len >= size) return;66 if (self.buf.len >= size) return;
67 self.realign();67 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;
69 self.buf = try self.allocator.realloc(self.buf, new_size);69 self.buf = try self.allocator.realloc(self.buf, new_size);
70 }70 }
7171
...@@ -126,21 +126,12 @@ pub fn LinearFifo(comptime T: type) type {...@@ -126,21 +126,12 @@ pub fn LinearFifo(comptime T: type) type {
126 @memset(unused2, undefined);126 @memset(unused2, undefined);
127 }127 }
128 }128 }
129 if (false and self.count == count) {129 var head = self.head + count;
130 self.head = 0;130 // Note it is safe to do a wrapping subtract as
131 self.count = 0;131 // bitwise & with all 1s is a noop
132 } else {132 head &= self.buf.len -% 1;
133 var head = self.head + count;133 self.head = head;
134 if (true) {134 self.count -= count;
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 }
144 }135 }
145136
146 /// Read the next item from the fifo137 /// Read the next item from the fifo
...@@ -270,11 +261,7 @@ pub fn LinearFifo(comptime T: type) type {...@@ -270,11 +261,7 @@ pub fn LinearFifo(comptime T: type) type {
270261
271 pub fn writeItemAssumeCapacity(self: *Self, item: T) void {262 pub fn writeItemAssumeCapacity(self: *Self, item: T) void {
272 var tail = self.head + self.count;263 var tail = self.head + self.count;
273 if (true) {264 tail &= self.buf.len - 1;
274 tail &= self.buf.len - 1;
275 } else {
276 tail %= self.buf.len;
277 }
278 self.buf[tail] = item;265 self.buf[tail] = item;
279 self.update(1);266 self.update(1);
280 }267 }
...@@ -333,11 +320,7 @@ pub fn LinearFifo(comptime T: type) type {...@@ -333,11 +320,7 @@ pub fn LinearFifo(comptime T: type) type {
333 assert(self.writableLength() >= count);320 assert(self.writableLength() >= count);
334321
335 var head = self.head + (self.buf.len - count);322 var head = self.head + (self.buf.len - count);
336 if (true) {323 head &= self.buf.len - 1;
337 head &= self.buf.len - 1;
338 } else {
339 head %= self.buf.len;
340 }
341 self.head = head;324 self.head = head;
342 self.count += count;325 self.count += count;
343 }326 }
...@@ -364,11 +347,7 @@ pub fn LinearFifo(comptime T: type) type {...@@ -364,11 +347,7 @@ pub fn LinearFifo(comptime T: type) type {
364 assert(offset < self.count);347 assert(offset < self.count);
365348
366 var index = self.head + offset;349 var index = self.head + offset;
367 if (true) {350 index &= self.buf.len - 1;
368 index &= self.buf.len - 1;
369 } else {
370 index %= self.buf.len;
371 }
372 return self.buf[index];351 return self.buf[index];
373 }352 }
374353