//! An array repeat literal of more than 32 elements fills the array in a loop, and stores nothing //! for an `undefined` item. A scalar item fills double words (see `array.repeat.word.lower.rad`). //! Any other item stores one element per iteration. A literal of at most 32 elements stores each //! element inline. A static initializer stays data of any length. This IL snapshot covers each //! case. /// Static table that the data section initializes. static TABLE: [u8; 4096] = [0; 4096]; /// Record with a string slice and a word. record Entry: Copy { /// Name of the entry. name: *[u8], /// Count of the entry. n: u32, } /// Fill 33 bytes. A scalar item needs no loop at this length. fn loopBytes(x: u8) -> u8 { let a: [u8; 33] = [x; 33]; return a[3]; } /// Store four bytes inline. fn inlineBytes(x: u8) -> u8 { let a: [u8; 4] = [x; 4]; return a[3]; } /// Fill 40 records in a loop, each by a blit. fn loopEntries(x: u32) -> u32 { let a: [Entry; 40] = [Entry { name: "", n: x }; 40]; return a[3].n; } /// Fill the outer array of a nested literal in a loop. The inner literal stays inline. fn loopNested(x: u8) -> u8 { let a: [[u8; 3]; 40] = [[x; 3]; 40]; return a[1][2]; } /// An `undefined` item gives a loop with no store, so the literal emits none. unsafe fn loopUndefined() -> u32 { let a: [u32; 100] = [undefined; 100]; return 0; } /// Read the static table, which no loop fills. fn readTable() -> u8 { return TABLE[7]; } @default fn main() -> i32 { return 0; }