Frank Shearar uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-fbs.699.mcz
==================== Summary ====================
Name: Kernel-fbs.699
Author: fbs
Time: 11 June 2012, 9:15:23.072 pm
UUID: 82d9060f-aaf6-4a84-934f-c7bcdd053e56
Ancestors: Kernel-fbs.698, Kernel-nice.695
Remerge Kernel-nice.695:
Provides a new version of significandAsInteger that relies on regular Float arithmetic and regular asInteger conversion.
In case of exceptional values, use the old behaviour, that is directly extract the bit pattern, but without implied one at position 53.
Marginally faster than old version - sorry, not significantly.
=============== Diff against Kernel-fbs.698 ===============
Item was changed:
----- Method: Float>>significandAsInteger (in category 'truncation and round off') -----
significandAsInteger
+ "Answer the mantissa of a Float shifted so as to have the ulp equal to 1.
+ For exceptional values, infinity and nan, just answer the bit pattern."
+ self isFinite ifTrue:
+ [^(self timesTwoPower: self class precision - 1 - (self exponent max: self class emin)) truncated abs].
+ ^(((self basicAt: 1) bitAnd: 16r000FFFFF) bitShift: 32) bitOr: (self basicAt: 2)!
- | exp sig |
- exp := self exponent.
- sig := (((self at: 1) bitAnd: 16r000FFFFF) bitShift: 32) bitOr: (self at: 2).
- (exp > -1023 and: [self ~= 0.0])
- ifTrue: [sig := sig bitOr: (1 bitShift: 52)].
- ^ sig.!
Frank Shearar uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-fbs.698.mcz
==================== Summary ====================
Name: Kernel-fbs.698
Author: fbs
Time: 11 June 2012, 9:12:51.486 pm
UUID: ceb4e4d0-4031-429d-9001-dd4dc44258ac
Ancestors: Kernel-fbs.697, Kernel-nice.694
Remerge Kernel-nice.694:
Protect floorLog: 2 for case of exceptional float values (because exponent does not)
Change exponent primitive fallback code to avoid a recursion with floorLog2:
Note that I created a separate selector #exponentFromBitPattern for handling fallback, because it's easier to test.
=============== Diff against Kernel-fbs.697 ===============
Item was changed:
----- Method: Float>>exponent (in category 'truncation and round off') -----
exponent
"Primitive. Consider the receiver to be represented as a power of two
multiplied by a mantissa (between one and two). Answer with the
SmallInteger to whose power two is raised. Optional. See Object
documentation whatIsAPrimitive."
- | positive |
<primitive: 53>
+ ^self exponentFromBitPattern!
- self >= 1.0 ifTrue: [^self floorLog: 2].
- self > 0.0
- ifTrue:
- [positive := (1.0 / self) exponent.
- self = (1.0 / (1.0 timesTwoPower: positive))
- ifTrue: [^positive negated]
- ifFalse: [^positive negated - 1]].
- self = 0.0 ifTrue: [^-1].
- ^self negated exponent!
Item was added:
+ ----- Method: Float>>exponentFromBitPattern (in category 'truncation and round off') -----
+ exponentFromBitPattern
+ "Extract the exponent from the bit pattern.
+ This is used only when primitive fails"
+
+ | exponent word1 |
+ self isFinite ifFalse: [^self error: 'cannot take the exponent of non finite Float'].
+ self = 0.0 ifTrue: [^-1].
+ word1 := self basicAt: 1.
+ exponent := (word1 bitShift: -20) bitAnd: 16r7FF.
+ ^exponent = 0
+ ifTrue:
+ [| high |
+ high := (word1 bitAnd: 16rFFFFF) highBit.
+ high := high = 0
+ ifTrue: [(self basicAt: 2) highBit]
+ ifFalse: [high + 32].
+ self class emin - self class precision + high]
+ ifFalse:
+ [exponent + self class emin - 1]!
Item was changed:
----- Method: Float>>floorLog: (in category 'mathematical functions') -----
floorLog: radix
"Answer the floor of the log base radix of the receiver.
The result may be off by one due to rounding errors, except in base 2."
+ (radix = 2 and: [self > 0.0 and: [self isFinite]]) ifTrue: [^self exponent].
- (radix = 2 and: [self > 0.0]) ifTrue: [^self exponent].
^ (self log: radix) floor
!
Frank Shearar uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-fbs.698.mcz
==================== Summary ====================
Name: Kernel-fbs.698
Author: fbs
Time: 11 June 2012, 9:12:51.486 pm
UUID: ceb4e4d0-4031-429d-9001-dd4dc44258ac
Ancestors: Kernel-fbs.697, Kernel-nice.694
Remerge Kernel-nice.694:
Protect floorLog: 2 for case of exceptional float values (because exponent does not)
Change exponent primitive fallback code to avoid a recursion with floorLog2:
Note that I created a separate selector #exponentFromBitPattern for handling fallback, because it's easier to test.
=============== Diff against Kernel-fbs.697 ===============
Item was changed:
----- Method: Float>>exponent (in category 'truncation and round off') -----
exponent
"Primitive. Consider the receiver to be represented as a power of two
multiplied by a mantissa (between one and two). Answer with the
SmallInteger to whose power two is raised. Optional. See Object
documentation whatIsAPrimitive."
- | positive |
<primitive: 53>
+ ^self exponentFromBitPattern!
- self >= 1.0 ifTrue: [^self floorLog: 2].
- self > 0.0
- ifTrue:
- [positive := (1.0 / self) exponent.
- self = (1.0 / (1.0 timesTwoPower: positive))
- ifTrue: [^positive negated]
- ifFalse: [^positive negated - 1]].
- self = 0.0 ifTrue: [^-1].
- ^self negated exponent!
Item was added:
+ ----- Method: Float>>exponentFromBitPattern (in category 'truncation and round off') -----
+ exponentFromBitPattern
+ "Extract the exponent from the bit pattern.
+ This is used only when primitive fails"
+
+ | exponent word1 |
+ self isFinite ifFalse: [^self error: 'cannot take the exponent of non finite Float'].
+ self = 0.0 ifTrue: [^-1].
+ word1 := self basicAt: 1.
+ exponent := (word1 bitShift: -20) bitAnd: 16r7FF.
+ ^exponent = 0
+ ifTrue:
+ [| high |
+ high := (word1 bitAnd: 16rFFFFF) highBit.
+ high := high = 0
+ ifTrue: [(self basicAt: 2) highBit]
+ ifFalse: [high + 32].
+ self class emin - self class precision + high]
+ ifFalse:
+ [exponent + self class emin - 1]!
Item was changed:
----- Method: Float>>floorLog: (in category 'mathematical functions') -----
floorLog: radix
"Answer the floor of the log base radix of the receiver.
The result may be off by one due to rounding errors, except in base 2."
+ (radix = 2 and: [self > 0.0 and: [self isFinite]]) ifTrue: [^self exponent].
- (radix = 2 and: [self > 0.0]) ifTrue: [^self exponent].
^ (self log: radix) floor
!
Frank Shearar uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-fbs.698.mcz
==================== Summary ====================
Name: Kernel-fbs.698
Author: fbs
Time: 11 June 2012, 9:12:51.486 pm
UUID: ceb4e4d0-4031-429d-9001-dd4dc44258ac
Ancestors: Kernel-fbs.697, Kernel-nice.694
Remerge Kernel-nice.694:
Protect floorLog: 2 for case of exceptional float values (because exponent does not)
Change exponent primitive fallback code to avoid a recursion with floorLog2:
Note that I created a separate selector #exponentFromBitPattern for handling fallback, because it's easier to test.
=============== Diff against Kernel-fbs.697 ===============
Item was changed:
----- Method: Float>>exponent (in category 'truncation and round off') -----
exponent
"Primitive. Consider the receiver to be represented as a power of two
multiplied by a mantissa (between one and two). Answer with the
SmallInteger to whose power two is raised. Optional. See Object
documentation whatIsAPrimitive."
- | positive |
<primitive: 53>
+ ^self exponentFromBitPattern!
- self >= 1.0 ifTrue: [^self floorLog: 2].
- self > 0.0
- ifTrue:
- [positive := (1.0 / self) exponent.
- self = (1.0 / (1.0 timesTwoPower: positive))
- ifTrue: [^positive negated]
- ifFalse: [^positive negated - 1]].
- self = 0.0 ifTrue: [^-1].
- ^self negated exponent!
Item was added:
+ ----- Method: Float>>exponentFromBitPattern (in category 'truncation and round off') -----
+ exponentFromBitPattern
+ "Extract the exponent from the bit pattern.
+ This is used only when primitive fails"
+
+ | exponent word1 |
+ self isFinite ifFalse: [^self error: 'cannot take the exponent of non finite Float'].
+ self = 0.0 ifTrue: [^-1].
+ word1 := self basicAt: 1.
+ exponent := (word1 bitShift: -20) bitAnd: 16r7FF.
+ ^exponent = 0
+ ifTrue:
+ [| high |
+ high := (word1 bitAnd: 16rFFFFF) highBit.
+ high := high = 0
+ ifTrue: [(self basicAt: 2) highBit]
+ ifFalse: [high + 32].
+ self class emin - self class precision + high]
+ ifFalse:
+ [exponent + self class emin - 1]!
Item was changed:
----- Method: Float>>floorLog: (in category 'mathematical functions') -----
floorLog: radix
"Answer the floor of the log base radix of the receiver.
The result may be off by one due to rounding errors, except in base 2."
+ (radix = 2 and: [self > 0.0 and: [self isFinite]]) ifTrue: [^self exponent].
- (radix = 2 and: [self > 0.0]) ifTrue: [^self exponent].
^ (self log: radix) floor
!
Frank Shearar uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-fbs.35.mcz
==================== Summary ====================
Name: ShoutCore-fbs.35
Author: fbs
Time: 11 June 2012, 9:28:28.141 am
UUID: b78331bb-dbe7-48bc-ab35-b2aacf11d0c4
Ancestors: ShoutCore-ul.34
An SHTextStyler shouldn't double initialise itself.
=============== Diff against ShoutCore-ul.34 ===============
Item was removed:
- ----- Method: SHTextStyler class>>new (in category 'as yet unclassified') -----
- new
- ^super new
- initialize;
- yourself!
Frank Shearar uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-fbs.35.mcz
==================== Summary ====================
Name: ShoutCore-fbs.35
Author: fbs
Time: 11 June 2012, 9:28:28.141 am
UUID: b78331bb-dbe7-48bc-ab35-b2aacf11d0c4
Ancestors: ShoutCore-ul.34
An SHTextStyler shouldn't double initialise itself.
=============== Diff against ShoutCore-ul.34 ===============
Item was removed:
- ----- Method: SHTextStyler class>>new (in category 'as yet unclassified') -----
- new
- ^super new
- initialize;
- yourself!
Frank Shearar uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-fbs.35.mcz
==================== Summary ====================
Name: ShoutCore-fbs.35
Author: fbs
Time: 11 June 2012, 9:28:28.141 am
UUID: b78331bb-dbe7-48bc-ab35-b2aacf11d0c4
Ancestors: ShoutCore-ul.34
An SHTextStyler shouldn't double initialise itself.
=============== Diff against ShoutCore-ul.34 ===============
Item was removed:
- ----- Method: SHTextStyler class>>new (in category 'as yet unclassified') -----
- new
- ^super new
- initialize;
- yourself!
Frank Shearar uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-fbs.413.mcz
==================== Summary ====================
Name: Tools-fbs.413
Author: fbs
Time: 11 June 2012, 8:45:35.501 pm
UUID: 04131505-191d-4f46-ba9e-64195d2ed007
Ancestors: Tools-eem.412
#showComment is identical to #showingDocumentation, and only has 1 sender, compared to #showingDocumentation's 9 senders. Both these messages belong to CodeHolder's internal protocols (so only it and its descendants use these methods).
=============== Diff against Tools-eem.412 ===============
Item was changed:
----- Method: CodeHolder>>selectedMessage (in category 'message list') -----
selectedMessage
"Answer a copy of the source code for the selected message. This generic version is probably actually never reached, since every subclass probably reimplements and does not send to super. In time, ideally, most, or all, reimplementors would vanish and all would defer instead to a universal version right here. Everything in good time."
| class selector method |
contents ifNotNil: [^ contents copy].
self showingDecompile ifTrue:[^ self decompiledSourceIntoContents].
class := self selectedClassOrMetaClass.
(class isNil or: [(selector := self selectedMessageName) isNil]) ifTrue: [^ ''].
method := class compiledMethodAt: selector ifAbsent: [^ '']. "method deleted while in another project"
currentCompiledMethod := method.
+ ^ contents := (self showingDocumentation
- ^ contents := (self showComment
ifFalse: [self sourceStringPrettifiedAndDiffed]
ifTrue: [ self commentContents])
copy asText makeSelectorBoldIn: class!
Item was removed:
- ----- Method: CodeHolder>>showComment (in category 'what to show') -----
- showComment
- "Answer whether the receiver should show documentation rather than, say, source code"
-
- ^ self contentsSymbol == #documentation
- !
Frank Shearar uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-fbs.413.mcz
==================== Summary ====================
Name: Tools-fbs.413
Author: fbs
Time: 11 June 2012, 8:45:35.501 pm
UUID: 04131505-191d-4f46-ba9e-64195d2ed007
Ancestors: Tools-eem.412
#showComment is identical to #showingDocumentation, and only has 1 sender, compared to #showingDocumentation's 9 senders. Both these messages belong to CodeHolder's internal protocols (so only it and its descendants use these methods).
=============== Diff against Tools-eem.412 ===============
Item was changed:
----- Method: CodeHolder>>selectedMessage (in category 'message list') -----
selectedMessage
"Answer a copy of the source code for the selected message. This generic version is probably actually never reached, since every subclass probably reimplements and does not send to super. In time, ideally, most, or all, reimplementors would vanish and all would defer instead to a universal version right here. Everything in good time."
| class selector method |
contents ifNotNil: [^ contents copy].
self showingDecompile ifTrue:[^ self decompiledSourceIntoContents].
class := self selectedClassOrMetaClass.
(class isNil or: [(selector := self selectedMessageName) isNil]) ifTrue: [^ ''].
method := class compiledMethodAt: selector ifAbsent: [^ '']. "method deleted while in another project"
currentCompiledMethod := method.
+ ^ contents := (self showingDocumentation
- ^ contents := (self showComment
ifFalse: [self sourceStringPrettifiedAndDiffed]
ifTrue: [ self commentContents])
copy asText makeSelectorBoldIn: class!
Item was removed:
- ----- Method: CodeHolder>>showComment (in category 'what to show') -----
- showComment
- "Answer whether the receiver should show documentation rather than, say, source code"
-
- ^ self contentsSymbol == #documentation
- !
Frank Shearar uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-fbs.413.mcz
==================== Summary ====================
Name: Tools-fbs.413
Author: fbs
Time: 11 June 2012, 8:45:35.501 pm
UUID: 04131505-191d-4f46-ba9e-64195d2ed007
Ancestors: Tools-eem.412
#showComment is identical to #showingDocumentation, and only has 1 sender, compared to #showingDocumentation's 9 senders. Both these messages belong to CodeHolder's internal protocols (so only it and its descendants use these methods).
=============== Diff against Tools-eem.412 ===============
Item was changed:
----- Method: CodeHolder>>selectedMessage (in category 'message list') -----
selectedMessage
"Answer a copy of the source code for the selected message. This generic version is probably actually never reached, since every subclass probably reimplements and does not send to super. In time, ideally, most, or all, reimplementors would vanish and all would defer instead to a universal version right here. Everything in good time."
| class selector method |
contents ifNotNil: [^ contents copy].
self showingDecompile ifTrue:[^ self decompiledSourceIntoContents].
class := self selectedClassOrMetaClass.
(class isNil or: [(selector := self selectedMessageName) isNil]) ifTrue: [^ ''].
method := class compiledMethodAt: selector ifAbsent: [^ '']. "method deleted while in another project"
currentCompiledMethod := method.
+ ^ contents := (self showingDocumentation
- ^ contents := (self showComment
ifFalse: [self sourceStringPrettifiedAndDiffed]
ifTrue: [ self commentContents])
copy asText makeSelectorBoldIn: class!
Item was removed:
- ----- Method: CodeHolder>>showComment (in category 'what to show') -----
- showComment
- "Answer whether the receiver should show documentation rather than, say, source code"
-
- ^ self contentsSymbol == #documentation
- !