Add reader1 and writer1 base types.

This commit is contained in:
Nigel Tao committed 2017-06-18 11:50:34 +10:00
1 parent d16a25806f
commit 17e47fbc1e
11 files changed
+169 -138

No files matched your search

+3 -3
View File
@@ -16,7 +16,7 @@ pub struct decoder?(
lzw lzw_decoder,
)
pub func decoder.decode?(dst ptr buf1, src ptr buf1)() {
pub func decoder.decode?(dst writer1, src reader1)() {
this.decode_header?(src:in.src)
this.decode_lsd?(src:in.src)
}
@@ -24,7 +24,7 @@ pub func decoder.decode?(dst ptr buf1, src ptr buf1)() {
// decode_header reads either "GIF87a" or "GIF89a".
//
// See the spec section 17 "Header" on page 7.
pri func decoder.decode_header?(src ptr buf1)() {
pri func decoder.decode_header?(src reader1)() {
var c[6] u8
var i u32
while i < 6 {
@@ -40,7 +40,7 @@ pri func decoder.decode_header?(src ptr buf1)() {
// decode_lsd reads the Logical Screen Descriptor.
//
// See the spec section 18 "Logical Screen Descriptor" on page 8.
pri func decoder.decode_lsd?(src ptr buf1)() {
pri func decoder.decode_lsd?(src reader1)() {
var c[7] u8
var i u32
while i < 7 {
+1 -1
View File
@@ -17,7 +17,7 @@ pub func lzw_decoder.set_literal_width(lw u32[2..8] = 8)() {
this.literal_width = in.lw
}
pub func lzw_decoder.decode?(dst ptr buf1, src ptr buf1)() {
pub func lzw_decoder.decode?(dst writer1, src reader1)() {
// These variables don't change over the lifetime of this func.
var clear_code u32[4..256] = (1 as u32) << this.literal_width
var end_code u32[5..257] = clear_code + 1