-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[readonly] Fix casts and add tests with ranges (#360)
- Loading branch information
Showing
166 changed files
with
1,771 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//@seman | ||
var x: Array<int>; | ||
var y = Array<int>.!(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//@seman = TypeError @ 3:22 | ||
var x: Array<bool>; | ||
var y = Array<int>.!(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@seman | ||
var x0: Array<byte>; | ||
var y0 = Array<byte>.!(x0); | ||
|
||
var x1: Array<u32>; | ||
var y1 = Array<u32>.!(x1); | ||
|
||
var x2: Array<string>; | ||
var y2 = Array<string>.!(x2); | ||
|
||
var x3: Array<void>; | ||
var y3 = Array<void>.!(x3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@execute =1 | ||
|
||
// An efficient data structure for a matrix of boolean values. | ||
class BitMatrix(var numrows: int, var numcols: int) { | ||
private var width: int = (numcols + 31) >>> 5; // width (in integers) of each row | ||
private var bits = Array<int>.new(numrows * width); // array that stores the data | ||
def rowInts(index: int) -> range<int> { | ||
if (index >= numrows) return null; | ||
return bits[(index * width) ..+ width]; | ||
} | ||
} | ||
|
||
var arr: array<int> = []; | ||
def assert(b: bool) { | ||
if (!b) var x = arr[2]; | ||
} | ||
|
||
def main() -> int { | ||
var b = BitMatrix.new(10, 62); | ||
var x = b.rowInts(2); | ||
var y = b.rowInts(5); | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=0; 4=4 | ||
def main(a: int) -> int { | ||
var x = Array<int>.new(a); | ||
var y: range<int> = range<int>.!(x); | ||
return y.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=44; 4=44 | ||
var x = Array<int>.new(44); | ||
def main(a: int) -> int { | ||
var y: range<int> = range<int>.!(x); | ||
return y.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=44; 4=44 | ||
var x = Array<int>.new(44); | ||
def main(a: int) -> int { | ||
var y: range<int> = Range<int>.!(x); | ||
return y.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute -1=!LengthCheckException; 0=0; 2=2 | ||
def main(a: int) -> int { | ||
var x = Array<int>.new(a); | ||
var y = range<int>.!(x); | ||
return y.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute true=1; false=0 | ||
def main(a: bool) -> int { | ||
var x: range<int> = range<int>.!(if(a, Array<int>.new(1))); | ||
return x.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute true=1; false=0 | ||
def main(a: bool) -> int { | ||
var x: range<int> = Range<int>.!(if(a, Array<int>.new(1))); | ||
return x.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute true=1; false=0 | ||
def main(a: bool) -> int { | ||
var x: Array<int> = if(a, Array<int>.new(1)); | ||
var y: range<int> = range<int>.!(x); | ||
return y.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute true=1; false=0 | ||
def main(a: bool) -> int { | ||
var x: Array<int> = if(a, Array<int>.new(1)); | ||
var y: range<int> = Range<int>.!(x); | ||
return y.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute 0=3 | ||
def x = [5555, 6666, 7777]; | ||
def main(a: int) -> int { | ||
return range<int>.length(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute 0=0; 1=1; 2=2; 3=3 | ||
def x = [5555, 6666, 7777]; | ||
def main(a: int) -> int { | ||
return range<int>.length(x[0 ..+ a]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=0; 1=1; 2=2; 3=3 | ||
def x = [5555, 6666, 7777]; | ||
def f = range<int>.length; | ||
def main(a: int) -> int { | ||
return f(x[0 ..+ a]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=0; 1=1; 2=2; 3=3 | ||
def x = [5555, 6666, 7777]; | ||
def f = range<int>.length; | ||
def main(a: int) -> int { | ||
return f(x[0 ... a]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=!LengthCheckException; 1=0; 2=1; 3=2 | ||
def x = [5555, 6666, 7777]; | ||
def f = range<int>.length; | ||
def main(a: int) -> int { | ||
return f(x[1 ... a]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute = true | ||
def main() -> bool { | ||
var x: range<int>; | ||
return x == null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute = false | ||
def x = [33, 44]; | ||
def main() -> bool { | ||
return range<int>.==(x[0 ...], null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute 0=true; 1=false; 3=false; 4=!BoundsCheckException | ||
def x = [33, 44, 55]; | ||
def main(a: int) -> bool { | ||
return range<int>.==(x[0 ...], x[a ...]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=false; 1=false; 3=false; 4=!BoundsCheckException | ||
def x = [33, 44, 55]; | ||
def y = [33, 44, 55]; | ||
def main(a: int) -> bool { | ||
return range<int>.==(x[0 ...], y[a ...]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute 0=false; 1=false; 2=true; 3=!BoundsCheckException | ||
def x = [33, 44]; | ||
def main(a: int) -> bool { | ||
return range<int>.==(x, x[0 ... a]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute 0=false; 1=false; 2=true; 3=!LengthCheckException | ||
def x = [33, 44]; | ||
def main(a: int) -> bool { | ||
return range<int>.==(x, x[0 ..+ a]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//@execute 0=2; 1=!TypeCheckException; 2=!TypeCheckException; 3=3; 4=47 | ||
class A { } | ||
class B extends A { } | ||
def castAA = range<A>.!<range<A>>; | ||
def castAB = range<A>.!<range<B>>; | ||
def castBA = range<B>.!<range<A>>; | ||
def castBB = range<B>.!<range<B>>; | ||
|
||
def x: range<A> = [A.new(), B.new()]; | ||
def y: range<B> = [B.new(), B.new(), B.new()]; | ||
|
||
def main(a: int) -> int { | ||
match (a) { | ||
0 => return castAA(x).length; | ||
1 => return castAB(y).length; | ||
2 => return castBA(x).length; | ||
3 => return castBB(y).length; | ||
} | ||
return 47; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//@execute 0=2; 1=!TypeCheckException; 2=!TypeCheckException; 3=3; 4=47 | ||
class A { } | ||
class B extends A { } | ||
|
||
def x: range<A> = [A.new(), B.new()]; | ||
def y: range<B> = [B.new(), B.new(), B.new()]; | ||
|
||
def main(a: int) -> int { | ||
match (a) { | ||
0 => return cast<A, A>(x).length; | ||
1 => return cast<B, A>(y).length; | ||
2 => return cast<A, B>(x).length; | ||
3 => return cast<B, B>(y).length; | ||
} | ||
return 47; | ||
} | ||
def cast<F, T>(x: range<F>) -> range<T> { | ||
return range<T>.!(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=3; 1=4; 2=!BoundsCheckException | ||
def x = [3, 4]; | ||
def y: range<int> = x; | ||
def main(a: int) -> int { | ||
return y[a]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=4; 1=5; 2=6; 3=!BoundsCheckException | ||
def x = [3, 4, 5, 6]; | ||
def y: range<int> = x[1 ...]; | ||
def main(a: int) -> int { | ||
return y[a]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute 0=4; 1=5; 2=!BoundsCheckException | ||
def x = [3, 4, 5, 6]; | ||
def y: range<int> = x[1 ... 3]; | ||
def main(a: int) -> int { | ||
return y[a]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=42; 1=!BoundsCheckException; 3=!BoundsCheckException; -1=!BoundsCheckException | ||
def x: array<void> = [(), (), ()]; | ||
def y: range<void> = x[1 ... 2]; | ||
|
||
def main(a: int) -> int { | ||
var d = y[a]; | ||
return 42; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=42; 1=42; 2=42; 3=!BoundsCheckException; -1=!BoundsCheckException | ||
def x: array<void> = [(), (), ()]; | ||
def y: range<void> = x; | ||
|
||
def main(a: int) -> int { | ||
var d = y[a]; | ||
return 42; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=42; 1=42; 2=42; 3=!BoundsCheckException; -1=!BoundsCheckException | ||
def x: array<void> = [(), (), ()]; | ||
def y: range<void> = x; | ||
|
||
def main(a: int) -> int { | ||
var d = y[a]; | ||
return 42; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute =2 | ||
def x: range<int> = [0, 0]; | ||
def main() -> int { | ||
return x.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute =2 | ||
def x: range<int> = [0, 0]; | ||
def f = range<int>.length; | ||
def main() -> int { | ||
return f(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//@execute =2 | ||
def x: range<(int, byte)> = [(0, 1), (2, 3)]; | ||
def main() -> int { | ||
return x.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute =2 | ||
def x: range<(int, string)> = [(0, "ff"), (0, "gg")]; | ||
def f = range<(int, string)>.length; | ||
def main() -> int { | ||
return f(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//@execute =2 | ||
def x: range<(int, void, string, bool)> = [(0, (), "ff", true), (0, (), "gg", false)]; | ||
def f = range<(int, void, string, bool)>.length; | ||
def main() -> int { | ||
return f(x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@execute 0=0; 1=!BoundsCheckException | ||
def x: range<int> = [33, 44]; | ||
def main(a: int) -> int { | ||
for (shift: u6 < 62) { | ||
var i = long.view(a) << shift; | ||
var s = x[i]; | ||
} | ||
return a; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute (-1, 2)=!BoundsCheckException; (0, 2)=2; (1, 2)=1; (-1, 3)=!BoundsCheckException; (0, 3)=3; (1, 3)=2; (-1, 4)=!BoundsCheckException; (0, 4)=!BoundsCheckException; (1, 4)=!BoundsCheckException | ||
def x: range<byte> = "abc"; | ||
def main(a: int, b: int) -> int { | ||
return sub(x, a, b).length; | ||
} | ||
def sub<T>(r: range<T>, a: long, b: long) -> range<T> { | ||
return r[a ... b]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute (-2147483648, 66)=!BoundsCheckException; (0, 66)=66; (1, 66)=65; (-2147483648, 88)=!BoundsCheckException; (0, 88)=88; (1, 88)=87; (-2147483648, 89)=!BoundsCheckException; (0, 89)=!BoundsCheckException; (1, 89)=!BoundsCheckException | ||
def x: range<void> = Array<void>.new(88); | ||
def main(a: int, b: int) -> int { | ||
return sub(x, a, b).length; | ||
} | ||
def sub<T>(r: range<T>, a: long, b: long) -> range<T> { | ||
return r[a ... b]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=!BoundsCheckException; 1=!BoundsCheckException; -1=!BoundsCheckException | ||
def x: range<byte> = "perf"; | ||
def main(a: int) -> int { | ||
return sub(x, 0x1_0000_0000L | a, x.length).length; | ||
} | ||
def sub<T>(r: range<T>, a: long, b: long) -> range<T> { | ||
return r[a ... b]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=!BoundsCheckException; 1=!BoundsCheckException; -1=!BoundsCheckException | ||
def x: range<byte> = "perf"; | ||
def main(a: int) -> int { | ||
return sub(x, 0, a | 0x16273_0000_0000L).length; | ||
} | ||
def sub<T>(r: range<T>, a: long, b: long) -> range<T> { | ||
return r[a ... b]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@execute 0=!BoundsCheckException; 1=!BoundsCheckException; -1=!BoundsCheckException | ||
def x: range<byte> = "perf"; | ||
def main(a: int) -> int { | ||
return sub(x, 0x1_0000_0000L | a, x.length).length; | ||
} | ||
def sub<T>(r: range<T>, a: long, b: long) -> range<T> { | ||
return r[a ..+ b]; | ||
} |
Oops, something went wrong.