[squeak-dev] The Trunk: Collections-nice.894.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 10 16:05:51 UTC 2020


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.894.mcz

==================== Summary ====================

Name: Collections-nice.894
Author: nice
Time: 10 May 2020, 6:05:49.347017 pm
UUID: e0e617fd-c214-46ec-a35d-10da6c1d6d87
Ancestors: Collections-nice.893

Clean-up required after the FloatArray rename in preamble and the ByteArray voyage in hierarchy in postcript.

=============== Diff against Collections-nice.893 ===============

Item was changed:
+ UnsignedIntegerArray variableByteSubclass: #ByteArray
- ArrayedCollection variableByteSubclass: #ByteArray
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Collections-Arrayed'!
  
  !ByteArray commentStamp: '<historical>' prior: 0!
  I represent an ArrayedCollection whose elements are integers between 0 and 255.
  !

Item was added:
+ ----- Method: Float32Array>>* (in category 'arithmetic') -----
+ * anObject
+ 
+ 	^self shallowCopy *= anObject!

Item was added:
+ ----- Method: Float32Array>>*= (in category 'arithmetic') -----
+ *= anObject
+ 	^anObject isNumber
+ 		ifTrue:[self primMulScalar: anObject asFloat]
+ 		ifFalse:[self primMulArray: anObject]!

Item was added:
+ ----- Method: Float32Array>>+ (in category 'arithmetic') -----
+ + anObject
+ 
+ 	^self shallowCopy += anObject!

Item was added:
+ ----- Method: Float32Array>>+= (in category 'arithmetic') -----
+ += anObject
+ 	^anObject isNumber
+ 		ifTrue:[self primAddScalar: anObject asFloat]
+ 		ifFalse:[self primAddArray: anObject]!

Item was added:
+ ----- Method: Float32Array>>- (in category 'arithmetic') -----
+ - anObject
+ 
+ 	^self shallowCopy -= anObject!

Item was added:
+ ----- Method: Float32Array>>-= (in category 'arithmetic') -----
+ -= anObject
+ 	^anObject isNumber
+ 		ifTrue:[self primSubScalar: anObject asFloat]
+ 		ifFalse:[self primSubArray: anObject]!

Item was added:
+ ----- Method: Float32Array>>/ (in category 'arithmetic') -----
+ / anObject
+ 
+ 	^self shallowCopy /= anObject!

Item was added:
+ ----- Method: Float32Array>>/= (in category 'arithmetic') -----
+ /= anObject
+ 	^anObject isNumber
+ 		ifTrue:[self primDivScalar: anObject asFloat]
+ 		ifFalse:[self primDivArray: anObject]!

Item was added:
+ ----- Method: Float32Array>>\\= (in category 'arithmetic') -----
+ \\= other
+ 
+ 	other isNumber ifTrue: [
+ 		1 to: self size do: [:i |
+ 			self at: i put: (self at: i) \\ other
+ 		].
+ 		^ self.
+ 	].
+ 	1 to: (self size min: other size) do: [:i |
+ 		self at: i put: (self at: i) \\ (other at: i).
+ 	].
+ 
+ !

Item was added:
+ ----- Method: Float32Array>>adaptToNumber:andSend: (in category 'arithmetic') -----
+ adaptToNumber: rcvr andSend: selector
+ 	"If I am involved in arithmetic with a Number. If possible,
+ 	convert it to a float and perform the (more efficient) primitive operation."
+ 	selector == #+ ifTrue:[^self + rcvr].
+ 	selector == #* ifTrue:[^self * rcvr].
+ 	selector == #- ifTrue:[^self negated += rcvr].
+ 	selector == #/ ifTrue:[
+ 		"DO NOT USE TRIVIAL CODE
+ 			^self reciprocal * rcvr
+ 		BECAUSE OF GRADUAL UNDERFLOW
+ 		self should: (1.0e-39 / (FloatArray with: 1.0e-39)) first < 2."
+ 			^(self class new: self size withAll: rcvr) / self
+ 		].
+ 	^super adaptToNumber: rcvr andSend: selector!

Item was added:
+ ----- Method: Float32Array>>asFloatArray (in category 'converting') -----
+ asFloatArray
+ 	^self!

Item was added:
+ ----- Method: Float32Array>>defaultElement (in category 'accessing') -----
+ defaultElement
+ 	"Return the default element of the receiver"
+ 	^0.0!

Item was added:
+ ----- Method: Float32Array>>length (in category 'accessing') -----
+ length
+ 	"Return the length of the receiver"
+ 	^self squaredLength sqrt!

Item was added:
+ ----- Method: Float32Array>>negated (in category 'arithmetic') -----
+ negated
+ 
+ 	^self shallowCopy *= -1!

Item was added:
+ ----- Method: Float32Array>>replaceFrom:to:with:startingAt: (in category 'private') -----
+ replaceFrom: start to: stop with: replacement startingAt: repStart 
+ 	"Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive."
+ 	<primitive: 105>
+ 	super replaceFrom: start to: stop with: replacement startingAt: repStart!

Item was added:
+ ----- Method: Float32Array>>squaredLength (in category 'accessing') -----
+ squaredLength
+ 	"Return the squared length of the receiver"
+ 	^self dot: self!



More information about the Squeak-dev mailing list