Browse Source

[tests] add test for 10783

Simon Krajewski 1 năm trước cách đây
mục cha
commit
0d313b0b27
1 tập tin đã thay đổi với 17 bổ sung0 xóa
  1. 17 0
      tests/unit/src/unit/issues/Issue10783.hx

+ 17 - 0
tests/unit/src/unit/issues/Issue10783.hx

@@ -0,0 +1,17 @@
+package unit.issues;
+
+class Issue10783 extends Test {
+	function test() {
+		eq(4, log2Unsigned(16));
+	}
+
+	@:pure inline function log2Unsigned(n:Int):Int {
+		var res = 0;
+
+		while ((n >>>= 1) != 0) {
+			res++;
+		}
+
+		return res;
+	}
+}