浏览代码

[tests] add test for 10783

Simon Krajewski 1 年之前
父节点
当前提交
0d313b0b27
共有 1 个文件被更改,包括 17 次插入0 次删除
  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;
+	}
+}