double dispatching
authorClaus Gittinger <cg@exept.de>
Fri, 12 Jan 2007 21:23:40 +0100
changeset 10319 d89f3a159d73
parent 10318 bef855ddbb59
child 10320 a573647dad4f
double dispatching
LongFloat.st
--- a/LongFloat.st	Fri Jan 12 19:45:10 2007 +0100
+++ b/LongFloat.st	Fri Jan 12 21:23:40 2007 +0100
@@ -1041,6 +1041,44 @@
     ^ super ~= aNumber
 ! !
 
+!LongFloat methodsFor:'double dispatching'!
+
+productFromInteger:anInteger
+    "sent when an integer does not know how to multiply the receiver, a float"
+
+%{  /* NOCONTEXT */
+
+    OBJ newFloat;
+    LONGFLOAT result;
+
+    if (__isSmallInteger(anInteger)) {
+        result = __longFloatVal(self) * (LONGFLOAT)(__intVal(anInteger));
+retResult:
+        __qMKLFLOAT(newFloat, result);
+        RETURN ( newFloat );
+    } 
+%}.
+    ^ super productFromInteger:anInteger
+!
+
+sumFromInteger:anInteger
+    "sent when an integer does not know how to add the receiver, a float"
+
+%{  /* NOCONTEXT */
+
+    OBJ newFloat;
+    LONGFLOAT result;
+
+    if (__isSmallInteger(anInteger)) {
+        result = __longFloatVal(self) + (LONGFLOAT)(__intVal(anInteger));
+retResult:
+        __qMKLFLOAT(newFloat, result);
+        RETURN ( newFloat );
+    } 
+%}.
+    ^ super sumFromInteger:anInteger
+! !
+
 !LongFloat methodsFor:'mathematical functions'!
 
 exp
@@ -2489,7 +2527,7 @@
 !LongFloat class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.57 2007-01-12 18:15:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.58 2007-01-12 20:23:40 cg Exp $'
 ! !
 
 LongFloat initialize!