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

+2 -2
View File
@@ -24,7 +24,7 @@ pub struct ieee?(
// TODO: should it be ? instead of ! because it's public, and might need a way
// to signal "initializer not called"? Should the return type, in the generated
// C code, be "struct{ uint32_t checksum; wuffs_crc32__status status }"?
pub func ieee.update(x[] u8)(checksum u32) {
pub func ieee.update(x slice u8)(checksum u32) {
var s u32 = 0xFFFFFFFF ^ this.state
iterate.1 (p ptr u8:in.x) {
@@ -37,7 +37,7 @@ pub func ieee.update(x[] u8)(checksum u32) {
// The table below was created by script/print-crc32-magic-numbers.go.
pri const ieee_table[256] u32 = $(
pri const ieee_table array[256] u32 = $(
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,