public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: tthomas@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Use integer return type for existing relational operations. Date: Wed, 14 Nov 2007 21:54:00 -0000 [thread overview] Message-ID: <20071114215431.17295.qmail@sourceware.org> (raw) The branch, master has been updated via d3ba8c41604b2cf30372d8bb00758b3d4e4596d0 (commit) from e60eaf6b29b3ca49957843adc7e69f898f0f1a43 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit d3ba8c41604b2cf30372d8bb00758b3d4e4596d0 Author: Teresa Thomas <tthomas@redhat.com> Date: Wed Nov 14 16:50:48 2007 -0500 Use integer return type for existing relational operations. frysk-core/frysk/value/ChangeLog 2007-11-14 Teresa Thomas <tthomas@redhat.com> * FloatingPointUnit.java: Use intType for relational operations. * IntegerUnit.java: Ditto. * TestValue.java (testFloatOps): Update. (testIntOps): Update. (isTrue (double)): Delete. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/value/ChangeLog | 9 +++- frysk-core/frysk/value/FloatingPointUnit.java | 12 ++-- frysk-core/frysk/value/IntegerUnit.java | 12 ++-- frysk-core/frysk/value/TestValue.java | 64 +++++++++++------------- 4 files changed, 49 insertions(+), 48 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog index 7ae7fae..9e7aed0 100644 --- a/frysk-core/frysk/value/ChangeLog +++ b/frysk-core/frysk/value/ChangeLog @@ -1,5 +1,12 @@ 2007-11-14 Teresa Thomas <tthomas@redhat.com> + * FloatingPointUnit.java: Use intType for relational + operations. + * IntegerUnit.java: Ditto. + * TestValue.java (testFloatOps): Update. + (testIntOps): Update. + (isTrue (double)): Delete. + * ArithmeticUnit.java (logicalAnd(Value,Value)): Delete. * ArithmeticUnit.java (logicalOr(Value,Value)): Delete. @@ -17,7 +24,7 @@ (getLogicalValue): New. * FloatingPointUnit.java: Update. (getLogicalValue): New. - * TestValue.java: Add tests for above. + * TestValue.java: Add tests for above. 2007-11-13 Teresa Thomas <tthomas@redhat.com> diff --git a/frysk-core/frysk/value/FloatingPointUnit.java b/frysk-core/frysk/value/FloatingPointUnit.java index 6b57434..fcaee8f 100644 --- a/frysk-core/frysk/value/FloatingPointUnit.java +++ b/frysk-core/frysk/value/FloatingPointUnit.java @@ -81,27 +81,27 @@ public class FloatingPointUnit } public Value lessThan (Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.doubleValue() < v2.doubleValue() ? 1:0); } public Value greaterThan (Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.doubleValue() > v2.doubleValue() ? 1:0); } public Value greaterThanOrEqualTo (Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.doubleValue() >= v2.doubleValue() ? 1:0); } public Value lessThanOrEqualTo (Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.doubleValue() <= v2.doubleValue() ? 1:0); } public Value equal (Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.doubleValue() == v2.doubleValue() ? 1:0); } public Value notEqual (Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.doubleValue() != v2.doubleValue() ? 1:0); } diff --git a/frysk-core/frysk/value/IntegerUnit.java b/frysk-core/frysk/value/IntegerUnit.java index ce3f505..01e5636 100644 --- a/frysk-core/frysk/value/IntegerUnit.java +++ b/frysk-core/frysk/value/IntegerUnit.java @@ -94,27 +94,27 @@ public class IntegerUnit } public Value lessThan(Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.asBigInteger().compareTo(v2.asBigInteger()) < 0 ? 1 : 0); } public Value greaterThan(Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.asBigInteger().compareTo(v2.asBigInteger()) > 0 ? 1 : 0); } public Value lessThanOrEqualTo(Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.asBigInteger().compareTo(v2.asBigInteger()) <= 0 ? 1 : 0); } public Value greaterThanOrEqualTo(Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.asBigInteger().compareTo(v2.asBigInteger()) >= 0 ? 1 : 0); } public Value equal(Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.asBigInteger().compareTo(v2.asBigInteger()) == 0 ? 1 : 0); } public Value notEqual(Value v1, Value v2) { - return retType.createValue + return intType.createValue (v1.asBigInteger().compareTo(v2.asBigInteger()) != 0 ? 1 : 0); } diff --git a/frysk-core/frysk/value/TestValue.java b/frysk-core/frysk/value/TestValue.java index 30507f5..76b8d04 100644 --- a/frysk-core/frysk/value/TestValue.java +++ b/frysk-core/frysk/value/TestValue.java @@ -94,14 +94,6 @@ public class TestValue else return false; } - - private boolean isTrue (double d) - { - if (d != 0) - return true; - else - return false; - } public void testIntOps () { @@ -121,18 +113,6 @@ public class TestValue assertEquals ("9 << 4", 9 << 4, v3.asLong()); v3 = v1.getType().getALU(v2.getType(), 0).shiftRight(v2, v1); assertEquals ("9 >> 4", 9 >> 4, v3.asLong()); - v3 = v1.getType().getALU(v2.getType(), 0).lessThan(v2, v1); - assertEquals ("9 < 4", 9 < 4, isTrue(v3.asLong())); - v3 = v1.getType().getALU(v2.getType(), 0).greaterThan(v2, v1); - assertEquals ("9 > 4", 9 > 4, isTrue(v3.asLong())); - v3 = v1.getType().getALU(v2.getType(), 0).lessThanOrEqualTo(v2, v1); - assertEquals ("9 <= 4", 9 <= 4, isTrue(v3.asLong())); - v3 = v1.getType().getALU(v2.getType(), 0).greaterThanOrEqualTo(v2, v1); - assertEquals ("9 >= 4", 9 >= 4, isTrue(v3.asLong())); - v3 = v1.getType().getALU(v2.getType(), 0).equal(v2, v1); - assertEquals ("9 == 4", 9 == 4, isTrue(v3.asLong())); - v3 =v1.getType().getALU(v2.getType(), 0).notEqual(v2, v1); - assertEquals ("9 != 4", 9 != 4, isTrue(v3.asLong())); v3 = v1.getType().getALU(v2.getType(), 0).bitWiseAnd(v2, v1); assertEquals ("9 && 4", 9 & 4, v3.asLong()); v3 = v1.getType().getALU(v2.getType(), 0).bitWiseOr(v2, v1); @@ -140,7 +120,20 @@ public class TestValue v3 = v1.getType().getALU(v2.getType(), 0).bitWiseXor(v2, v1); assertEquals ("9 ^ 4", 9 ^ 4, v3.asLong()); v3 = v1.getType().getALU(v2.getType(), 0).bitWiseComplement(v1); - assertEquals ("~4", ~4, v3.asLong()); + assertEquals ("~4", ~4, v3.asLong()); + // wordSize required for constructing integer return type. + v3 = v1.getType().getALU(v2.getType(), wordSize).lessThan(v2, v1); + assertEquals ("9 < 4", 9 < 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).greaterThan(v2, v1); + assertEquals ("9 > 4", 9 > 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).lessThanOrEqualTo(v2, v1); + assertEquals ("9 <= 4", 9 <= 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).greaterThanOrEqualTo(v2, v1); + assertEquals ("9 >= 4", 9 >= 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).equal(v2, v1); + assertEquals ("9 == 4", 9 == 4, isTrue(v3.asLong())); + v3 =v1.getType().getALU(v2.getType(), wordSize).notEqual(v2, v1); + assertEquals ("9 != 4", 9 != 4, isTrue(v3.asLong())); v3 = v1.getType().getALU(wordSize).logicalAnd(v2, v1, null); assertEquals ("9 && 4", 1, v3.asLong()); v3 = v1.getType().getALU(wordSize).logicalOr(v2, v1, null); @@ -164,7 +157,7 @@ public class TestValue v3 = v1.getType().getALU(v2.getType(), 0).shiftLeftEqual(v3, v1); assertEquals ("v3 <<= 4", 0, v3.asLong()); v3 = v1.getType().getALU(v2.getType(), 0).shiftRightEqual(v3, v1); - assertEquals ("v3 >>= 4", 0, v3.asLong()); + assertEquals ("v3 >>= 4", 0, v3.asLong()); v3 = v1.getType().getALU(v2.getType(), 0).bitWiseOrEqual(v3, v1); assertEquals ("v3 |= 4", 4, v3.asLong()); v3 = v1.getType().getALU(v2.getType(), 0).bitWiseXorEqual(v3, v1); @@ -186,18 +179,6 @@ public class TestValue assertEquals ("9 * 4", 9 * 4, v3.doubleValue(), 0); v3 = v1.getType().getALU(v2.getType(), 0).mod(v2, v1); assertEquals ("9 % 4", 9 % 4, v3.doubleValue(), 0); - v3 = v1.getType().getALU(v2.getType(), 0).lessThan(v2, v1); - assertEquals ("9 < 4", 9 < 4, isTrue(v3.doubleValue())); - v3 = v1.getType().getALU(v2.getType(), 0).greaterThan(v2, v1); - assertEquals ("9 > 4", 9 > 4, isTrue(v3.doubleValue())); - v3 = v1.getType().getALU(v2.getType(), 0).lessThanOrEqualTo(v2, v1); - assertEquals ("9 <= 4", 9 <= 4, isTrue(v3.doubleValue())); - v3 = v1.getType().getALU(v2.getType(), 0).greaterThanOrEqualTo(v2, v1); - assertEquals ("9 >= 4", 9 >= 4, isTrue(v3.doubleValue())); - v3 = v1.getType().getALU(v2.getType(), 0).equal(v2, v1); - assertEquals ("9 == 4", 9 == 4, isTrue(v3.doubleValue())); - v3 = v1.getType().getALU(v2.getType(), 0).notEqual(v2, v1); - assertEquals ("9 != 4", v2 != v1, isTrue(v3.doubleValue())); v3 = v3.assign(v1); assertEquals ("v3 = 4", 4, v3.doubleValue(), 0); v3 = v3.getType().getALU(v1.getType(), 0).plusEqual(v3, v1); @@ -210,7 +191,20 @@ public class TestValue assertEquals ("v3 /= 4", 4, v3.doubleValue(), 0); v3 = v3.getType().getALU(v1.getType(), 0).modEqual(v3, v1); assertEquals ("v3 %= 4", 0, v3.doubleValue(), 0); - // Note: Return type of logical expression is int. + // Note: Return type of relational, logical expression is int. + // wordSize required for constructing integer return type. + v3 = v1.getType().getALU(v2.getType(), wordSize).lessThan(v2, v1); + assertEquals ("9 < 4", 9 < 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).greaterThan(v2, v1); + assertEquals ("9 > 4", 9 > 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).lessThanOrEqualTo(v2, v1); + assertEquals ("9 <= 4", 9 <= 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).greaterThanOrEqualTo(v2, v1); + assertEquals ("9 >= 4", 9 >= 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).equal(v2, v1); + assertEquals ("9 == 4", 9 == 4, isTrue(v3.asLong())); + v3 = v1.getType().getALU(v2.getType(), wordSize).notEqual(v2, v1); + assertEquals ("9 != 4", v2 != v1, isTrue(v3.asLong())); v3 = v1.getType().getALU(wordSize).logicalAnd(v2, v1, null); assertEquals ("9 && 4", 1, v3.asLong()); v3 = v1.getType().getALU(wordSize).logicalOr(v2, v1, null); hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-11-14 21:54 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20071114215431.17295.qmail@sourceware.org \ --to=tthomas@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).