*** empty log message ***
authorclaus
Thu, 09 Mar 1995 10:45:46 +0100
changeset 305 26b092c71935
parent 304 3ce8e59c9ec3
child 306 365e65400c93
*** empty log message ***
Float.st
SmallInt.st
SmallInteger.st
--- a/Float.st	Thu Mar 09 04:27:56 1995 +0100
+++ b/Float.st	Thu Mar 09 10:45:46 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Float.st,v 1.23 1995-02-26 18:13:20 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Float.st,v 1.24 1995-03-09 09:45:42 claus Exp $
 '!
 
 !Float class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Float.st,v 1.23 1995-02-26 18:13:20 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Float.st,v 1.24 1995-03-09 09:45:42 claus Exp $
 "
 !
 
@@ -232,7 +232,7 @@
 	    RETURN ( newFloat );
 	}
     } else {
-        if (__isFloatLike(aNumber)) {
+	if (__isFloatLike(aNumber)) {
 	    val = _floatVal(aNumber);
 	    if (val != 0.0) {
 		result = _floatVal(self) / val;
@@ -386,7 +386,7 @@
      by numeric value (i.e. 3.0 = 3), therefore 3.0 hash must be the same
      as 3 hash."
 
-    |i idx|
+    |i|
 
     (self >= SmallInteger minVal and:[self <= SmallInteger maxVal]) ifTrue:[
 	i := self asInteger.
@@ -396,13 +396,12 @@
     ].
 
     "
-     mhmh take my value-bits to hash on
+     mhmh take some of my value-bits to hash on
     "
-    idx := self basicSize.
-    ^ (((self basicAt:idx) bitAnd:16r3F) bitShift:24) +
-      ((self basicAt:idx-1) bitShift:16) +
-      ((self basicAt:idx-2) bitShift:8) +
-      (self basicAt:idx-3)
+    ^ (((self basicAt:8) bitAnd:16r3F) bitShift:24) +
+      ((self basicAt:7) bitShift:16) +
+      ((self basicAt:6) bitShift:8) +
+      (self basicAt:5)
 
     "
      3 hash       
--- a/SmallInt.st	Thu Mar 09 04:27:56 1995 +0100
+++ b/SmallInt.st	Thu Mar 09 10:45:46 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.23 1995-02-26 18:14:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.24 1995-03-09 09:45:46 claus Exp $
 '!
 
 !SmallInteger class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.23 1995-02-26 18:14:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.24 1995-03-09 09:45:46 claus Exp $
 "
 !
 
@@ -332,6 +332,13 @@
     ^ self retry:#<= coercing:aNumber
 !
 
+hash
+    "return an integer useful for hashing on value"
+
+    self >= 0 ifTrue:[^ self].
+    ^ self negated
+!
+
 identityHash
     "return an integer useful for hashing on identity"
 
@@ -1354,8 +1361,8 @@
 /*
     _qNew(newFloat, sizeof(struct floatstruct), SENDER);
     if (newFloat != nil) {
-        _InstPtr(newFloat)->o_class = Float;
-        _FloatInstPtr(newFloat)->f_floatvalue = _intVal(self);
+	_InstPtr(newFloat)->o_class = Float;
+	_FloatInstPtr(newFloat)->f_floatvalue = _intVal(self);
     }
 */
     RETURN ( newFloat );
@@ -1654,9 +1661,9 @@
     sz = sizeof(struct stringheader) + strlen(buffer) + 1;
     _qNew(newString, sz, SENDER);
     if (newString != nil) {
-        _InstPtr(newString)->o_class = String;
-        strcpy(_stringVal(newString), buffer);
-        RETURN (newString);
+	_InstPtr(newString)->o_class = String;
+	strcpy(_stringVal(newString), buffer);
+	RETURN (newString);
     }
 %}.
     ^ super printString
--- a/SmallInteger.st	Thu Mar 09 04:27:56 1995 +0100
+++ b/SmallInteger.st	Thu Mar 09 10:45:46 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.23 1995-02-26 18:14:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.24 1995-03-09 09:45:46 claus Exp $
 '!
 
 !SmallInteger class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.23 1995-02-26 18:14:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.24 1995-03-09 09:45:46 claus Exp $
 "
 !
 
@@ -332,6 +332,13 @@
     ^ self retry:#<= coercing:aNumber
 !
 
+hash
+    "return an integer useful for hashing on value"
+
+    self >= 0 ifTrue:[^ self].
+    ^ self negated
+!
+
 identityHash
     "return an integer useful for hashing on identity"
 
@@ -1354,8 +1361,8 @@
 /*
     _qNew(newFloat, sizeof(struct floatstruct), SENDER);
     if (newFloat != nil) {
-        _InstPtr(newFloat)->o_class = Float;
-        _FloatInstPtr(newFloat)->f_floatvalue = _intVal(self);
+	_InstPtr(newFloat)->o_class = Float;
+	_FloatInstPtr(newFloat)->f_floatvalue = _intVal(self);
     }
 */
     RETURN ( newFloat );
@@ -1654,9 +1661,9 @@
     sz = sizeof(struct stringheader) + strlen(buffer) + 1;
     _qNew(newString, sz, SENDER);
     if (newString != nil) {
-        _InstPtr(newString)->o_class = String;
-        strcpy(_stringVal(newString), buffer);
-        RETURN (newString);
+	_InstPtr(newString)->o_class = String;
+	strcpy(_stringVal(newString), buffer);
+	RETURN (newString);
     }
 %}.
     ^ super printString