Introduce "array[N] T" and "slice T" type syntax

This commit is contained in:
Nigel Tao committed 2018-04-05 22:21:08 +10:00
1 parent 2b91e7861c
commit d33db6dae0
15 files changed
+83 -68

No files matched your search

+6 -6
View File
@@ -53,8 +53,8 @@ pub struct decoder?(
// gct and lct are the Global / Local Color Tables: 256 (R, G, B) entries.
//
// TODO: 4 byte per pixel RGBA or BGRA instead of 3 bpp RGB?
gct[3 * 256] u8,
lct[3 * 256] u8,
gct array[3 * 256] u8,
lct array[3 * 256] u8,
lzw lzw_decoder,
)
@@ -122,7 +122,7 @@ pub func decoder.decode_frame?(dst io_writer, src io_reader)() {
//
// See the spec section 17 "Header" on page 7.
pri func decoder.decode_header?(src io_reader)() {
var c[6] u8
var c array[6] u8
var i u32
while i < 6 {
c[i] = in.src.read_u8?()
@@ -138,7 +138,7 @@ pri func decoder.decode_header?(src io_reader)() {
//
// See the spec section 18 "Logical Screen Descriptor" on page 8.
pri func decoder.decode_lsd?(src io_reader)() {
var c[7] u8
var c array[7] u8
var i u32
while i < 7 {
c[i] = in.src.read_u8?()
@@ -196,12 +196,12 @@ pri func decoder.skip_blocks?(src io_reader)() {
}
// animexts1dot0 is "ANIMEXTS1.0" as bytes.
pri const animexts1dot0[11] u8 = $(
pri const animexts1dot0 array[11] u8 = $(
0x41, 0x4E, 0x49, 0x4D, 0x45, 0x58, 0x54, 0x53, 0x31, 0x2E, 0x30,
)
// netscape2dot0 is "NETSCAPE2.0" as bytes.
pri const netscape2dot0[11] u8 = $(
pri const netscape2dot0 array[11] u8 = $(
0x4E, 0x45, 0x54, 0x53, 0x43, 0x41, 0x50, 0x45, 0x32, 0x2E, 0x30,
)