[squeak-dev] The Trunk: Kernel-ul.1007.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Mar 20 00:01:18 UTC 2016


Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1007.mcz

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

Name: Kernel-ul.1007
Author: ul
Time: 20 March 2016, 12:46:32.331305 am
UUID: 10e56dde-9a4b-4fe5-af9f-a02546962e66
Ancestors: Kernel-ul.1006, Kernel-bf.1006

- merged
- quicker SmallInteger>>printOn:base:length:padded: for base 10, the most common case

=============== Diff against Kernel-ul.1006 ===============

Item was changed:
  ----- Method: Pragma>>hasLiteral: (in category 'testing') -----
  hasLiteral: aLiteral
  	^keyword == aLiteral 
+ 	   or: [(arguments hasLiteral: aLiteral)
+ 		or: [keyword == #hasLiteralTest: and: [
+ 			self methodClass perform: arguments first with: aLiteral]]]!
- 	   or: [arguments hasLiteral: aLiteral]!

Item was changed:
  ----- Method: SmallInteger>>printOn:base:length:padded: (in category 'printing') -----
  printOn: stream base: base length: minimumLength padded: padWithZeroes
  
  	| n numberOfDigits totalLength divisor |
  	self < 0
  		ifTrue: [
  			n := self negated.
  			totalLength := 1 ]
  		ifFalse: [
  			n := self.
  			totalLength := 0 ].
  	numberOfDigits := n numberOfDigitsInBase: base.
  	totalLength := totalLength + numberOfDigits.
  	padWithZeroes ifFalse: [
  		[ totalLength < minimumLength ] whileTrue: [
  			stream space.
  			totalLength := totalLength + 1 ] ].
+ 	self < 0 ifTrue: [ stream nextPut: $- ].
- 	n = self ifFalse: [ stream nextPut: $- ].
  	padWithZeroes ifTrue: [
  		[ totalLength < minimumLength ] whileTrue: [
  			stream nextPut: $0.
  			totalLength := totalLength + 1 ] ].
+ 	divisor := base = 10
+ 		ifTrue: [ #(1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000 10000000000 100000000000 1000000000000 10000000000000 100000000000000 1000000000000000 10000000000000000 100000000000000000 1000000000000000000) at: numberOfDigits ]
+ 		ifFalse: [ base raisedToInteger: numberOfDigits - 1 ].
- 	divisor := (base raisedToInteger: numberOfDigits - 1).
  	[ divisor > 0 ] whileTrue: [
  		| digit |
  		digit := n // divisor.
  		stream nextPut: ('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' at: digit + 1).
  		n := n - (digit * divisor).
  		divisor := divisor // base ]!



More information about the Squeak-dev mailing list