*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Wed, 05 Feb 2014 01:33:24 +0100
changeset 3169 89969fe0320f
parent 3168 ed488959e0b1
child 3170 6b4ea43f498c
*** empty log message ***
HalfFloatArray.st
--- a/HalfFloatArray.st	Tue Feb 04 21:41:47 2014 +0100
+++ b/HalfFloatArray.st	Wed Feb 05 01:33:24 2014 +0100
@@ -187,13 +187,14 @@
 %{  /* NOCONTEXT */
     if (__isSmallInteger(index)) {
 	int i = __intVal(index);
+	int n = __wordArraySize(self);
 
-	if ((unsigned int)i <= __wordArraySize(self)) {
+	if ((unsigned)i <= n) {
 	    unsigned short h;
 	    OBJ newFloat;
 	    float f;
 
-	    h = __WordArrayInstPtr(self)->s_element[i];
+	    h = __WordArrayInstPtr(self)->s_element[i-1];
 
 	    f = __STX_halffloat_to_float(h);
 	    __qMKSFLOAT(newFloat, f);
@@ -208,8 +209,9 @@
 %{
     if (__isSmallInteger(index)) {
 	int i = __intVal(index);
+	int n = __wordArraySize(self);
 
-	if ((unsigned)i <= __wordArraySize(self)) {
+	if ((unsigned)i <= n) {
 	    unsigned short h;
 	    float f;
 
@@ -223,7 +225,7 @@
 		goto error;
 
 	    h = __STX_float_to_halffloat(f);
-	    __WordArrayInstPtr(self)->s_element[i] = h;
+	    __WordArrayInstPtr(self)->s_element[i-1] = h;
 	    RETURN (aFloat);
 	}
     }
@@ -245,6 +247,6 @@
 !HalfFloatArray class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/HalfFloatArray.st,v 1.2 2014-02-04 20:40:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/HalfFloatArray.st,v 1.3 2014-02-05 00:33:24 cg Exp $'
 ! !