Hey @eesheng, the << operator in sway is used for bitwise left shift operations. The expression 1 << 62 means shifting the binary representation of the number 1 to the left by 62 positions. This operation effectively multiplies the number by (2^{62}).

In your code,

timestamp value is 4611686018427387924 thats logged. 1 << 62 results in 4611686018427387904. Adding 10 to 4611686018427387904 gives 4611686018427387914. Subtracting this from the current timestamp results in 10. thus the value 10 is logged.

This code directly calculates 1 << 62 ie 4611686018427387904.
and thus the value 4611686018427387904 is logged.

In Rust 1 << 62 overflows because 1 without type annotation is by default i32 . It is essentially the same as having 1_i32 << 62_i32. In Sway, the default numeric type is u64 which means the expression gets interpreted as 1u64 << 62u64 which properly gives 2^62 = 4611686018427387904. Of course, if you write in Rust 1u64 << 62 it will also not overflow and will result in the same number.