more intuitive left shift and right shift operators
Before: * << is left shift, not allowed to shift 1 bits out * <<% is left shift, allowed to shift 1 bits out * >> is right shift, allowed to shift 1 bits out After: * << is left shift, allowed to shift 1 bits out * >> is right shift, allowed to shift 1 bits out * @shlExact is left shift, not allowed to shift 1 bits out * @shrExact is right shift, not allowed to shift 1 bits out Closes #413
This commit is contained in:
@@ -1959,4 +1959,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
|
||||
\\}
|
||||
,
|
||||
".tmp_source.zig:2:15: error: expected pointer, found 'i32'");
|
||||
|
||||
cases.add("@shlExact shifts out 1 bits",
|
||||
\\comptime {
|
||||
\\ const x = @shlExact(u8(0b01010101), 2);
|
||||
\\}
|
||||
,
|
||||
".tmp_source.zig:2:15: error: operation caused overflow");
|
||||
|
||||
cases.add("@shrExact shifts out 1 bits",
|
||||
\\comptime {
|
||||
\\ const x = @shrExact(u8(0b10101010), 2);
|
||||
\\}
|
||||
,
|
||||
".tmp_source.zig:2:15: error: exact shift shifted out 1 bits");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user