E1093: constant shift count outside the type width

View source

<< and >> move the bits of the left operand, and the count must be smaller than the width of its type (ADR-0044).

<< and >> move the bits of the left operand, and the count must be smaller than the width of its type (ADR-0044). A count that is a constant and is too large is reported while compiling. The message gives the count and the valid range as a half-open range, so 0..8 means 0 to 7. The width of Int is 32 bits. A count that is only known at run time traps when it is too large. The error points at the count.

Example

actus
verb main() {
    erg n: u8 = 1u8;
    erg m = n << 8;
}

Fix

Use a count inside the width, or shift a wider type.

actus
verb main() {
    erg n: u8 = 1u8;
    erg m = n << 7;
}
actus
verb main() {
    erg n: u32 = 1u32;
    erg m = n << 8;
}

Run actus explain E1093 in your terminal to read this entry offline. Browse Ownership & types or all error codes.