authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-11-11 01:25:38+11:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-11-25 09:26:33+11:00
log6037f892125fc87996450f3f985b0d2eb38765c0
tree7b37eb6dda269c651f932715d4b2c94d4029ed1d
parentcd749e04161a1a3899ed0a723a5cde444159900e
signaturelock-open Commit is signed but in an unrecognized format.

std: fifo rename from FixedSizeFifo to LinearFifo


1 files changed, 8 insertions(+), 8 deletions(-)

lib/std/fifo.zig+8-8
...@@ -9,7 +9,7 @@ const debug = std.debug;...@@ -9,7 +9,7 @@ const debug = std.debug;
9const assert = debug.assert;9const assert = debug.assert;
10const testing = std.testing;10const testing = std.testing;
1111
12pub const FifoBufferType = union(enum) {12pub const LinearFifoBufferType = union(enum) {
13 /// The buffer is internal to the fifo; it is of the specified size.13 /// The buffer is internal to the fifo; it is of the specified size.
14 Static: usize,14 Static: usize,
1515
...@@ -20,9 +20,9 @@ pub const FifoBufferType = union(enum) {...@@ -20,9 +20,9 @@ pub const FifoBufferType = union(enum) {
20 Dynamic,20 Dynamic,
21};21};
2222
23pub fn FixedSizeFifo(23pub fn LinearFifo(
24 comptime T: type,24 comptime T: type,
25 comptime buffer_type: FifoBufferType,25 comptime buffer_type: LinearFifoBufferType,
26) type {26) type {
27 const autoalign = false;27 const autoalign = false;
2828
...@@ -332,8 +332,8 @@ pub fn FixedSizeFifo(...@@ -332,8 +332,8 @@ pub fn FixedSizeFifo(
332 };332 };
333}333}
334334
335test "FixedSizeFifo(u8, .Dynamic)" {335test "LinearFifo(u8, .Dynamic)" {
336 var fifo = FixedSizeFifo(u8, .Dynamic).init(debug.global_allocator);336 var fifo = LinearFifo(u8, .Dynamic).init(debug.global_allocator);
337 defer fifo.deinit();337 defer fifo.deinit();
338338
339 try fifo.write("HELLO");339 try fifo.write("HELLO");
...@@ -397,10 +397,10 @@ test "FixedSizeFifo(u8, .Dynamic)" {...@@ -397,10 +397,10 @@ test "FixedSizeFifo(u8, .Dynamic)" {
397 }397 }
398}398}
399399
400test "FixedSizeFifo" {400test "LinearFifo" {
401 inline for ([_]type{ u1, u8, u16, u64 }) |T| {401 inline for ([_]type{ u1, u8, u16, u64 }) |T| {
402 inline for ([_]FifoBufferType{ FifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {402 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
403 const FifoType = FixedSizeFifo(T, bt);403 const FifoType = LinearFifo(T, bt);
404 var buf: if (bt == .Slice) [32]T else void = undefined;404 var buf: if (bt == .Slice) [32]T else void = undefined;
405 var fifo = switch (bt) {405 var fifo = switch (bt) {
406 .Static => FifoType.init(),406 .Static => FifoType.init(),