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