summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2007-05-24 20:56:35 +0000
committerRoman Kennke <roman@kennke.org>2007-05-24 20:56:35 +0000
commit4038e1edf3cc3ad4eb53f873ecf6a2fd1565c695 (patch)
tree4f32e8b7cde173060a183db67cd39521483144f9
parentc559b24555d6917692118aa0245958918d389201 (diff)
downloadclasspath-4038e1edf3cc3ad4eb53f873ecf6a2fd1565c695.tar.gz
2007-05-24 Roman Kennke <roman@kennke.org>
* gnu/java/math/Fixed.java (trunc): New method.
-rw-r--r--ChangeLog5
-rw-r--r--gnu/java/math/Fixed.java13
2 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c6cd0fbb9..28678c36d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2007-05-24 Roman Kennke <roman@kennke.org>
+ * gnu/java/math/Fixed.java
+ (trunc): New method.
+
+2007-05-24 Roman Kennke <roman@kennke.org>
+
* gnu/java/awt/java2d/AbstractGraphics2D.java
(fillShape): Pass rendering hints to scanline converter.
* gnu/java/awt/java2d/ScanlineConverter.java
diff --git a/gnu/java/math/Fixed.java b/gnu/java/math/Fixed.java
index e0284c329..ed4150b10 100644
--- a/gnu/java/math/Fixed.java
+++ b/gnu/java/math/Fixed.java
@@ -109,6 +109,19 @@ public final class Fixed
}
/**
+ * Truncates the number so that only the digits after the point are left.
+ *
+ * @param n the number of digits
+ * @param a the fixed point value
+ *
+ * @return the truncated value
+ */
+ public static int trunc(int n, int a)
+ {
+ return a & (0xFFFFFFFF >>> 32 - n);
+ }
+
+ /**
* Returns the round value of a fixed point value <code>a</code> with
* the <code>n</code> digits.
*