|
Re: Re: Adding methods to Integers...: msg#00096lang.smalltalk.squeak.beginners
This is actually wrong. Only SmallIntegers are special [*]. What happens is this: When you add two SmallIntegers (like "3 + 4"), and the result is a SmallInteger, the result is calculated in the bytecode directly. Otherwise, a regular send of #+ is performed. From there, everything else happens in the image, including conversion to LargeIntegers - see implementors of #+. Like, if the receiver was a SmallInteger, it tries the "add" primitive, which fails, and then the implementation of #+ in class Integer is invoked. This method then creates a large integer. For the implementation of all this see #bytecodePrimAdd and #primitiveAdd. You may have to load VMMaker first. - Bert - [*] Well, Floats are optimized a bit, and we have a plugin to speed up LargeIntegers, but this is all optional and doesn't matter in this discussion. On Apr 12, 2007, at 18:05 , Klaus D. Witzel wrote: Hi Patrick,
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Error: No content to install, Isaac Gouy |
|---|---|
| Next by Date: | Re: Squeak Firefox plugin on Linux, Andrew Dabrowski |
| Previous by Thread: | Re: Adding methods to Integers..., Klaus D. Witzel |
| Next by Thread: | Re: Adding methods to Integers..., Klaus D. Witzel |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |