adding opcodes and results
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
const std = @import("std");
|
||||
const spv = @import("spv.zig");
|
||||
|
||||
const SpvWord = spv.SpvWord;
|
||||
@@ -20,6 +21,12 @@ pub fn next(self: *Self) ?SpvWord {
|
||||
return word;
|
||||
}
|
||||
|
||||
pub fn nextAs(self: *Self, comptime E: type) ?E {
|
||||
const word = self.peek() orelse return null;
|
||||
self.index += 1;
|
||||
return std.enums.fromInt(E, word);
|
||||
}
|
||||
|
||||
pub fn peek(self: *const Self) ?SpvWord {
|
||||
return if (self.index >= self.buffer.len) null else self.buffer[self.index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user