changeset 1503:276623518fb1

[Issue 1150] Compiler creates wrong code <niqbmozgvx@mailinator.com> 2007-04-15 http://d.puremagic.com/issues/show_bug.cgi?id=1150
author thomask
date Mon, 23 Apr 2007 18:00:36 +0000
parents 898e31994aae
children 805b24f2e33f
files run/o/odd_bug_15_A.d
diffstat 1 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/o/odd_bug_15_A.d	Mon Apr 23 18:00:36 2007 +0000
@@ -0,0 +1,39 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	<niqbmozgvx@mailinator.com>
+// @date@	2007-04-15
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1150
+// @desc@	[Issue 1150] Compiler creates wrong code
+
+module dstress.run.o.odd_bug_15_A;
+
+class RangeCoder {
+	uint[258] cumCount;
+	uint lower;
+	uint upper;
+	ulong range;
+
+	this() {
+		for (int i=0; i < cumCount.length; i++){
+			cumCount[i] = i;
+		}
+		lower = 0;
+		upper = 0xffffffff;
+		range = 0x100000000;
+	}
+
+	void encode(uint symbol) {
+		uint total = cumCount[length - 1];		
+		upper = lower + cast(uint)((cumCount[symbol+1] * range) / total) - 1;
+		lower = lower + cast(uint)((cumCount[symbol]   * range) / total);
+	}
+
+}
+
+int main() {
+	RangeCoder rc = new RangeCoder();
+	rc.encode(77);
+	return 0;
+}