aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannesw <none@none>2014-04-14 17:43:38 +0200
committerhannesw <none@none>2014-04-14 17:43:38 +0200
commit19ba623793f5539d230677da57e7eaaf8941f486 (patch)
tree013306df4203470e0d50f0c5007d1af1382413f5 /src
parentcf1cb3f0849884ca2e4ade1f5a310fb084a4dcaa (diff)
downloadnashorn-19ba623793f5539d230677da57e7eaaf8941f486.tar.gz
8030199: Nashorn: Uint8ClampedArray - Incorrect ToUint8Clamp implementation
Reviewed-by: sundar, jlaskey, lagergren
Diffstat (limited to 'src')
-rw-r--r--src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java b/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
index d757ee3a..d69adc10 100644
--- a/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
+++ b/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
@@ -89,6 +89,15 @@ public final class NativeUint8ClampedArray extends ArrayBufferView {
}
@Override
+ protected void setImpl(final int index, final long value) {
+ if (JSType.isRepresentableAsInt(value)) {
+ setImpl(index, (int)value);
+ } else {
+ buffer.getByteArray()[byteIndex(index)] = value > 0 ? (byte)0xff : 0;
+ }
+ }
+
+ @Override
protected void setImpl(final int key, final double value) {
setImpl(key, (int)Math.rint(value));
}